Reputation: 41
i have a large number of json files 2M(5Go).I imported to mongodB, I noticed that the total size of my mongoDb has only (0.9Go) which mean mongodb helps me to reduce momery storage. what is the explication behind this?is some kind of compression or just because he store is a json object instead json files ?
Upvotes: 1
Views: 1177
Reputation: 230296
BSON is more compact (as mentioned by @amiasato), but not by a lot. You don't have quotes or braces, but you have to specify length for every field. _id field and other binary blobs take 2x less space compared to JSON, but in a typical db, these do not take up the majority of space.
The disk usage savings you're observing are coming from WiredTiger's compression of data files, I'm 99% sure. (WiredTiger is the default storage engine in current version of mongodb)
Upvotes: 2