Glossary
BSON
Binary JSON, MongoDB's storage format
BSON (Binary JSON) is the binary-encoded data format MongoDB uses for storage and over-the-wire communication. JSON-shaped at the API level — same object/array hierarchy — but binary on disk and on the network.
Why a binary format when JSON exists:
- Type fidelity. JSON has only string, number, boolean, null, object, array. BSON adds Date, Binary, ObjectId, Decimal128, Regex, Timestamp, Int32 vs Int64. Round-trips through BSON preserve the exact type.
- Self-describing length headers. Every BSON document and value is prefixed with its length, so MongoDB can skip over fields without parsing them. JSON requires reading from the start.
- Decimal arithmetic. BSON’s Decimal128 type stores exact decimal numbers up to 34 significant digits — important for financial data where IEEE 754 floats round badly.
BSON files are typically 10-20% larger than equivalent JSON because of the length headers and explicit type tags, but query performance is dramatically faster because MongoDB doesn’t have to parse the document to find a field.
Most MongoDB drivers (Node, Python, Java, Go) automatically convert between BSON and the language’s native types. You rarely interact with BSON directly unless you’re writing a driver or reading the bson backup files outside MongoDB itself.
Published May 15, 2026