We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b0cf5e8 commit ff54943Copy full SHA for ff54943
src/db.ts
@@ -31,19 +31,25 @@ export function countRequests() {
31
{
32
$project: {
33
affiliations: { $objectToArray: "$user.affiliations" },
34
+ month: { $month: { $toDate: "$date" } },
35
+ year: { $year: { $toDate: "$date" } },
36
}
37
},
38
39
$unwind: "$affiliations"
40
41
42
$group: {
- _id: "$affiliations.k",
43
+ _id: {
44
+ month: "$month",
45
+ year: "$year",
46
+ affiliation: "$affiliations.k"
47
+ },
48
count: { $sum: 1 }
49
50
51
- $sort: { count: -1 }
52
+ $sort: { "_id.year": 1, "_id.month": 1, count: -1 }
53
54
])
55
.toArray();
0 commit comments