"count" : 1552400, "size" : 1571028800.0, "avgObjSize" : 1012, "storageSize" : 229552128,

from my understanding of the above stats, "avgObjSize" gives the size of a document in the collection and "size" gives the sum size of all the documents(no index size included) in the collection. but when i computed the total size of a collection 264282112 bytes. this is less than "size" 1571028800 in bytes. storage engine i am using here is wiredTiger and block compresses "snappy " is enabled.

can anyone please explain when the document stored to disk, does it store as compressed or does it store with the size of "avgObjSize" (in my case 1012 bytes).

1 Answer 1


As per Mongodb documentation:

The total size in memory of all records in a collection. This value does not include the record header, which is 16 bytes per record, but does include the record’s padding. Additionally size does not include the size of any indexes associated with the collection, which the totalIndexSize field reports.

You have :

  • The number of objects or documents in this collection = 1552400
  • The average size of an object in the collection (plus any padding)=1012


Output shows 1571028800 which is very close to what is expected.

How do you get 264282112?

Documents are compressed when stored in disk but storageSize shows allocated space.

The total amount of storage allocated to this collection for document storage. The scale argument affects this value.

storageSize does not include index size.

  • 264282112 is the total size of the collection ( "totalIndexSize" : 34729984 + "storageSize" : 229552128). when i calculated the size of document wih this size (i,e 264282112 /1552400(number of documents)) i got the size of document as 170 bytes. "avgObjSize" : 1012 is the size of the document. when i say the document size on disk,which value should i consider either 170 bytes or 1012 bytes?
    – Vasu H S
    Jun 21, 2017 at 8:51
  • Any thoughts for my comment please
    – Vasu H S
    Jun 21, 2017 at 11:18
  • 1
    170 bytes but you cannot take that value and forecast, it will depend on the compression ratio you get. It will always vary with the content of the document. Jun 21, 2017 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.