Created
May 28, 2018 06:55
-
-
Save zizkebab/93b920fb05a2e36010a0c79b979db9b3 to your computer and use it in GitHub Desktop.
Get MongoDB collections' index size, data size and total size.
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
use mydb | |
db.getCollectionNames().forEach(function(x){print(x + ": " + db.getCollection(x).totalIndexSize()/(1024*1024*1024) + ", " + db.getCollection(x).dataSize()/(1024*1024*1024) + ", " + db.getCollection(x).totalSize()/(1024*1024*1024))}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment