This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("Database,Collection,Index Name,Is Unique,Is Sparse,TTL (seconds),Fields"); | |
db.getMongo().getDBs().databases.forEach(function(database) { | |
// print("\nDatabase:", database.name); | |
if (database.name !== 'admin' && database.name !== 'local' && database.name !== 'config') { | |
var dbs = db.getSiblingDB(database.name); | |
dbs.getCollectionNames().forEach(function(collName) { | |
// print("\collName:", collName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create an object to store all index information | |
var clusterIndexes = {}; | |
db.getMongo().getDBs().databases.forEach(function(database) { | |
if (database.name !== 'admin' && database.name !== 'local' && database.name !== 'config') { | |
clusterIndexes[database.name] = {}; | |
var dbs = db.getSiblingDB(database.name); | |
dbs.getCollectionNames().forEach(function(collName) { | |
clusterIndexes[database.name][collName] = db.getCollection(collName).getIndexes(); |
OlderNewer