Skip to content

Instantly share code, notes, and snippets.

@srafay
Created January 21, 2020 08:36
Show Gist options
  • Save srafay/cc54d8a72bf67db0fda7902df2e8d407 to your computer and use it in GitHub Desktop.
Save srafay/cc54d8a72bf67db0fda7902df2e8d407 to your computer and use it in GitHub Desktop.
Mongo DB useful cmds
Get all collection size:
collectionNames.forEach(function (n) { stats.push(db[n].stats()); });
var byteToMB = 1024*1024;
for (var c in stats) { print(stats[c]['ns'] + ": " + stats[c]['size']/byteToMB + "(MB) (" + stats[c]['storageSize']/byteToMB + ") (MB)"); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment