BSON Format
BSON (Binary JSON) is the binary encoding used by MongoDB, supporting JSON types plus extensions such as Date, ObjectId, Binary, and RegExp.
Purpose
It provides MongoDB with a traversable, richly typed binary document representation that supports efficient indexing and queries.
Mechanism
A document is encoded as a length-prefixed sequence of (key, type, value) triples, where the type identifies the value kind (double/string/document/array/binary/objectid/date, etc.). Elements are laid out in key order for easy scanning.
Use cases
- MongoDB document storage
- MongoDB wire protocol
- Richly typed binary exchange