Skip to content

Instantly share code, notes, and snippets.

@normgraham
Created January 30, 2014 19:28
Show Gist options
  • Select an option

  • Save normgraham/8716876 to your computer and use it in GitHub Desktop.

Select an option

Save normgraham/8716876 to your computer and use it in GitHub Desktop.
Print all the indexes on all the databases on a replica set member
var printAllIndexes = function() {
rs.slaveOk()
db.adminCommand({"listDatabases":1}).databases.forEach(function(doc){
print(doc.name);
db.getSiblingDB(doc.name).system.indexes.find().sort({ns:1,name:1}).forEach(printjson);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment