MongoDB stores data and indexes on disk in a compressed binary format. Individual documents are represented in BSON, a binary JSON-like serialisation format that supports additional data types such as dates, 32-bit integers, 64-bit integers, 128-bit decimals, ObjectIDs, and binary data.
Data is written to disk using block compression for documents and prefix compression for indexes. Compression defaults are configurable at a global level and can also be set on a per-collection and per-index basis during collection and index creation.
For further reading that might provide helpful background info, see:
- FAQ: MongoDB Storage
- Compression options in MongoDB 3.0
- Does WiredTiger compression include stuff stored in RAM?
- Why is an empty MongoDB Database so big?
- Why does MongoDB check for order of keys when matching embedded documents?
Regards,
Stennie