Answer the question
In order to leave comments, you need to log in
How to display the full date when grouping by date?
how can I group, let's say, by month and get the output period: "07/01/2020-07/31/2020" ?
{
"$group": {
"_id": {
"name": "$name",
},
"period": {
'year': { '$month': "$created_at" },
},
},
"result": {
"$sum": 1
}
}
},
{
"$project": {
'_id': 0,
"period": '$_id.period',
"result": "$result"
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question