Group by day/month/week basis on the date range
问题 This is in reference to this question. This is my data set: [ { "rating": 4, "ceatedAt": ISODate("2016-08-08T15:32:41.262+0000") }, { "rating": 3, "createdAt": ISODate("2016-08-08T15:32:41.262+0000") }, { "rating": 3, "ceatedAt": ISODate("2016-07-01T15:32:41.262+0000") }, { "rating": 5, "createdAt": ISODate("2016-07-01T15:32:41.262+0000") } ] I want to be able to filter basis on week or month basis on the date range. How would I do that in mongo? This was the answer given for grouping by days