Skip to content

Instantly share code, notes, and snippets.

@KekSfabrik
Created January 18, 2017 08:24
Show Gist options
  • Save KekSfabrik/8af01e3a713fe47a29d6a215177ac58a to your computer and use it in GitHub Desktop.
Save KekSfabrik/8af01e3a713fe47a29d6a215177ac58a to your computer and use it in GitHub Desktop.
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