Database

[{ "_id": ObjectId("5ab3f0975c4f698c8a39ea22"), "DISTRICT": "vskp", "STATION": "appcb", "TAKEN_DATE": ISODate("2018-02-25T00:18:00.000Z"), "OZONE": 8.84, "pm10": "69.0", "pm2dots": "49.0", "DATA_FROM": "vsk", "CREATE_DATE": ISODate("2018-02-05T00:30:05.867Z") }]

Query

db.collection.aggregate([{ $match: { CREATE_DATE: { $lte: ISODate("2018-03-23T00:18:00.000Z"), $gte: ISODate("2017-12-23T00:18:00.000Z") } } }, { $group: { _id: { month: { $month: "$CREATE_DATE" }, year: { $year: "$CREATE_DATE" } }, avgofozone: { $avg: "$OZONE" } } }, { $sort: { "year": -1 } }, { $project: { year: "$_id.year", month: "$_id.month", _id: 0, avgofozone: 1 } } ])

Result