Created
January 28, 2019 17:08
-
-
Save Visrozar/542abcf66799c6b845304ee376be7c91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.collection.aggregate([ | |
{ | |
"$group": { | |
"_id": { | |
"date": { | |
$dateToString: { | |
format: "%Y-%m-%d", | |
date: "$time" | |
} | |
}, | |
"product": "$product" | |
} | |
} | |
}, | |
{ | |
"$group": { | |
"_id": "$_id.date", | |
"count": { | |
"$sum": 1 | |
} | |
} | |
} | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment