Reputation: 21565
How come that the storage size of the whole mongo database is smaller than total document size?
Upvotes: 6
Views: 2271
Reputation: 65313
MongoDB's WiredTiger storage engine compresses data and indexes by default, so the database storage size on disk (which includes both collection & index data) is typically smaller than the sum of the uncompressed document sizes and index sizes reported in collection stats.
The ratio of storage to uncompressed data size will vary depending on factors such as how compressible your data is, the number and type of indexes you create, whether you have deleted a significant number of documents (creating free space which is available for reuse), and any configuration changes from the default server or collection options.
In your example, you have a total of about 273.5 MB of data & indexes in this database using 70.9 MB of disk storage.
Upvotes: 10