Skip to content

Instantly share code, notes, and snippets.

@KekSfabrik
Created January 18, 2017 08:24
var storageSize = 0
db._adminCommand("listDatabases").databases.forEach(function (d) {
mdb = db.getSiblingDB(d.name);
mdb.getCollectionNames().forEach(function(c) {
s = mdb[c].stats();
storageSize += s.storageSize
})
})
printjson((storageSize / 1024 / 1024 / 1024) + "GB")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment