Skip to content

Instantly share code, notes, and snippets.

@shao1555
Created January 27, 2014 05:32
Show Gist options
  • Save shao1555/8643691 to your computer and use it in GitHub Desktop.
Save shao1555/8643691 to your computer and use it in GitHub Desktop.
print disk usage per collections
db.getCollectionNames().forEach(
function(n) {
stats = db.getCollection(n).stats();
print([n, stats.size, stats.storageSize, stats.storageSize+stats.totalIndexSize, stats.totalIndexSize].join("\t"))
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment