Skip to content

Instantly share code, notes, and snippets.

@karan9
Created November 2, 2020 14:56
Show Gist options
  • Save karan9/5927a708d40f8fc1d2adbf84144674b5 to your computer and use it in GitHub Desktop.
Save karan9/5927a708d40f8fc1d2adbf84144674b5 to your computer and use it in GitHub Desktop.
var colls = db.getCollectionNames();
var ret = [];
colls.forEach(function(coll) {
var indexes = db.getCollection(coll).getIndexes();
var len = indexes.length
ret.push({ "name": coll, "length": len });
})
printjson(ret)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment