Skip to content

Instantly share code, notes, and snippets.

@radeksimko
Created May 6, 2012 12:53
Show Gist options
  • Save radeksimko/2622198 to your computer and use it in GitHub Desktop.
Save radeksimko/2622198 to your computer and use it in GitHub Desktop.
Mongo - List all indexes + versions
db.getCollectionNames().forEach( function ( collectionName ) {
print( collectionName );
var indexes = db.eval( 'db.' + collectionName + '.getIndexes()' );
indexes.forEach( function( index ) {
print( ' - (v ' + index.v + ') ' + index.name );
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment