Details
-
Bug
-
Resolution: Won't Fix
-
Minor - P4
-
None
-
*Location*: http://docs.mongodb.org/manual/faq/storage/#how-can-i-check-the-size-of-a-collection
*User-Agent*: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36
*Referrer*: http://www.google.com/url?q=http%3A%2F%2Fdocs.mongodb.org%2Fmanual%2Ffaq%2Fstorage%2F%23how-can-i-check-the-size-of-a-collection&sa=D&sntz=1&usg=AFQjCNHuHX7cmlfin5Qcbjr2w0NPDsoHqw
*Screen Resolution*: 1920 x 1200
*repo*: docs
*source*: faq/storage
*Location*: http://docs.mongodb.org/manual/faq/storage/#how-can-i-check-the-size-of-a-collection *User-Agent*: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36 *Referrer*: http://www.google.com/url?q=http%3A%2F%2Fdocs.mongodb.org%2Fmanual%2Ffaq%2Fstorage%2F%23how-can-i-check-the-size-of-a-collection&sa=D&sntz=1&usg=AFQjCNHuHX7cmlfin5Qcbjr2w0NPDsoHqw *Screen Resolution*: 1920 x 1200 *repo*: docs *source*: faq/storage
Description
The docs say:
db.collection.totalSize(): the data size plus the index size in bytes.
I believe that totalSize() is actually storageSize + totalIndexSize.
Here's the data from a sample collection and the calculations:
> db.auditMessage.dataSize()
19304319728
> db.auditMessage.storageSize()
19417829280
> db.auditMessage.totalIndexSize()
280322336
> db.auditMessage.totalSize()
19698151616
dataSize + totalIndexSize: 19304319728 + 280322336 = 19584642064
storageSize + totalIndexSize: 19417829280 + 280322336 = 19698151616