If I want to search maximum temperature from all record of the collection then below query is perfect
db.posts3.aggregate([{$group:{ _id: "maximum",Temperature:{$max:"$Temperature"}}}]);
If I want to search the maximum temperature of the last two days the mongo query not work.
db.posts3.aggregate([{$group:
{ _id: "maximum",
{"time":{"$gt": ISODate("2019-10-12T11:25:06.156Z"),
"$lt":ISODate("2019-12-12T11:25:07.156Z")}
},
Temperature:{$max:"$Temperature"}
}
}
]);