Skip to content

Instantly share code, notes, and snippets.

@genki
Created July 3, 2022 00:09
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 genki/f5fbcd71ea523f053c6e8357c67a496a to your computer and use it in GitHub Desktop.
Save genki/f5fbcd71ea523f053c6e8357c67a496a to your computer and use it in GitHub Desktop.
Find unused indexes out of mongodb
db.<collections>.aggregate({$indexStats:{}})._batch.reduce((h,i) => {h[i.spec.name] = i.accesses.ops; return h}, {})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment