Last Updated: February 25, 2016
·
728
· jumand

Easy to read stats from the MongoDB shell

This gist below is a script to print an easy-to-read table of stats for your collections from within your mongo shell.

https://gist.github.com/abonhomme/7132858

The output will look like this:

> printStorageStats()
Thu Oct 31 2013 14:12:39 GMT-0400 (EDT)
Collection          |   *Size |  Effcy% |    Idxs
-------------------------------------------------
test.people         |  8.2 kB |    0.63 | 16.4 kB
test.system.indexes |  4.1 kB |    3.71 |     0 B
-------------------------------------------------
                    | 12.3 kB |         | 16.4 kB

2 Responses
Add your response

Something is wrong with the last row in the *Size column. It looks like it should be a total while for 8.2kB + 4.1kB it presents 204B instead of 12.3kB.

over 1 year ago ·

Good catch, thanks! I was calculating the total storage size with ".size" instead of ".storageSize" I've posted an update.

over 1 year ago ·