Last active
January 28, 2019 17:08
-
-
Save Visrozar/85b66109f642a261540533b884615343 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": { | |
"$dateToString": { | |
"format": "%Y-%m-%d", | |
"date": "$time" | |
} | |
}, | |
"count": { | |
"$addToSet": "$product" | |
} | |
} | |
}, | |
{ | |
$addFields: { | |
"count": { | |
"$size": "$count" | |
} | |
} | |
} | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment