Created
January 21, 2020 08:36
-
-
Save srafay/cc54d8a72bf67db0fda7902df2e8d407 to your computer and use it in GitHub Desktop.
Mongo DB useful cmds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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