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
Written by Arjumand Bonhomme
Related protips
2 Responses
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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Mongodb
Authors
dominikgarber
81.15K
sativaware
80.22K
Related Tags
#mongodb
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#