Skip to content

Instantly share code, notes, and snippets.

@cristopher-rodrigues
Last active February 7, 2017 02:17
Show Gist options
  • Save cristopher-rodrigues/a0d7f540f4fcf19758eb to your computer and use it in GitHub Desktop.
Save cristopher-rodrigues/a0d7f540f4fcf19758eb to your computer and use it in GitHub Desktop.
list all indexes on database (mongo)
db.getCollectionNames().forEach(function(collection) {
indexes = db[collection].getIndexes();
print("Indexes for " + collection + ":");
printjson(indexes);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment