What is the difference between collection stats sizes (size, storageSize, totalSize)?

Hello,

I have confusions on collection size properties, in collection stats db.collection.stats(),

  • size
  • storageSize
  • totalSize

Can anyone please explain what is the difference between the above properties, I looked at the reference documentation, but did not get the exact difference.

Thanks.

1 Like

The output is described here (linked from the page you were on): https://www.mongodb.com/docs/manual/reference/command/collStats/#output

2 Likes

Thanks for the link, got the answer,

I have a confusion, size shows the uncompressed size, and storageSize shows the compressed size,

So which size MongoDB server will originally occupy in memory, uncompressed or compressed?

Thanks.

Uncompressed size is what’s in WiredTiger cache (what you probably think of as “memory”) the compressed data is what’s written to disk.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.