mirror of
https://github.com/Mastermindzh/examples.git
synced 2024-11-25 12:12:55 +01:00
15 lines
372 B
JavaScript
15 lines
372 B
JavaScript
|
db = db.getSiblingDB("admin");
|
||
|
dbs = db.runCommand({ listDatabases: 1 }).databases;
|
||
|
|
||
|
var indexList = {};
|
||
|
|
||
|
dbs.forEach(function (database) {
|
||
|
db = db.getSiblingDB(database.name);
|
||
|
db.getCollectionNames().forEach(function (collection) {
|
||
|
indexes = db[collection].getIndexes();
|
||
|
indexList[`${database.name}/${collection}`] = indexes;
|
||
|
});
|
||
|
});
|
||
|
|
||
|
printjson(indexList);
|