Last active
December 11, 2018 07:42
-
-
Save gotraveltoworld/26301a7ab69f03759c6659bea06847e9 to your computer and use it in GitHub Desktop.
MongoDB's syntax for aggregation.
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.getCollection('logs').aggregate([ | |
{ | |
'$match': { | |
'number': 0 | |
} | |
}, | |
{ | |
'$group': { | |
'_id' : {'id': '$id'}, | |
'items': { | |
'$push': { | |
'id': '$id', | |
'url': '$url', | |
'number': '$number' | |
} | |
} | |
} | |
} | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment