Class._get_collection().aggregate([{'$group': {'_id': {'year': {'$year':
    '$utc_timestamp'}, 'month': {'$month': '$utc_timestamp'}, 'day': {
    '$dayOfMonth': '$utc_timestamp'}}, 'defects': {'$sum': {'$cond': [{
    '$eq': ['$status', 'defect']}, 1, 0]}}, 'totalCount': {'$sum': 1}}}, {
    '$project': {'defect_rate': {'$cond': [{'$eq': ['$defects', 0]}, 0, {
    '$divide': ['$defects', '$totalCount']}]}}}])
How to run this MongoDB query using MongoEngine