Last active
November 5, 2020 10:15
-
-
Save karan9/bbf172e48b3651fb9b0fae62a5421e63 to your computer and use it in GitHub Desktop.
This file contains 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
var colls = db.getCollectionNames(); | |
var ret = []; | |
colls.forEach(function(coll) { | |
if (String(coll).startsWith("system")) { | |
return; | |
} | |
var indexes = db.getCollection(coll).getIndexes(); | |
var stats = db.getCollection(coll).aggregate( [ { $indexStats: { } } ] ); | |
var len = indexes.length | |
ret.push({ "name": coll, "length": len, "data": stats._batch}); | |
}) | |
printjson(ret) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment