Created
October 8, 2015 17:31
-
-
Save alexrutherford/00bf93da79dbc3d17552 to your computer and use it in GitHub Desktop.
Count most common page categories in MongoDB
This file contains hidden or 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.pages.aggregate([ | |
| {$match:{id:{$exists:true}}}, | |
| {$group:{_id:'$category',total:{$sum:1}}}, | |
| {$sort:{total:-1}} | |
| ]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment