Skip to content

Instantly share code, notes, and snippets.

@codyhanson
Created November 13, 2017 16:02
Show Gist options
  • Save codyhanson/7a9703e04ccf0d687410e7d7d3d92c8e to your computer and use it in GitHub Desktop.
Save codyhanson/7a9703e04ccf0d687410e7d7d3d92c8e to your computer and use it in GitHub Desktop.
MongoDB count non-unique
db.cases.aggregate([{"$group":{"_id":"$guid", "count": {"$sum":1}}}, {"$match": {"count":{"$gt":1}}}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment