Skip to content

Instantly share code, notes, and snippets.

@deeTEEcee
Last active July 25, 2018 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deeTEEcee/c3eaf6932e6e05f5056cba3658edf28c to your computer and use it in GitHub Desktop.
Save deeTEEcee/c3eaf6932e6e05f5056cba3658edf28c to your computer and use it in GitHub Desktop.
mongo cheatsheet

Missing Indexes

db.getCollection('system.profile').find({'ns': 'db.collection_name', 'planSummary': {'$not': /IXSCAN/}})

Nested Grouping (group_by) of one or more fields.

db.etl_cluster_distribution.aggregate([ {"$group": {"_id": {"node_hostname":"$node_hostname", "tenant": "$tenant", "state": "$state"}, "items": {"$push": "$$ROOT"}}}])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment