1yourModel.aggregate([
2 {
3 $group: {
4 _id: {
5 $dateToString: {
6 format: "%Y-%m-%d",
7 date: "$date"
8 }
9 },
10 count: {
11 $sum: 1
12 }
13 }
14 },
15 {
16 $sort: {
17 _id: 1
18 }
19 }
20])