Skip to content

Instantly share code, notes, and snippets.

@Imater
Created October 15, 2014 04:54
Show Gist options
  • Save Imater/6a0e9a71bec5040a0655 to your computer and use it in GitHub Desktop.
Save Imater/6a0e9a71bec5040a0655 to your computer and use it in GitHub Desktop.
Mongo agregate and distinct
db.CommonHeaderRule.aggregate({$group: {_id: "$Titles", count: {$sum:1}}}, {$sort: {count:-1}})
db.AssortmentHeaderRule.count()
db.AssortmentHeaderRule.distinct("Title")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment