BSON (Binary JSON)
A binary-encoded serialization of JSON-like documents, designed to be efficient for storage and scanning.
BSON is the primary data format used by the MongoDB database. It extends the JSON model to include additional data types like dates and binary data, and it is optimized for speed and space efficiency within the database.
BSON vs JSON
Feature | JSON | BSON |
---|---|---|
Format | Text-based | Binary |
Readability | Human-readable | Not human-readable |
Size | Smaller | Larger due to metadata |
Performance | Slower for parsing | Faster for encoding/decoding |
Data Types | Limited (e.g., no binary, date) | Supports more types (e.g., date, int, binary) |
Use Case | APIs, web apps | MongoDB storage and transport |
Learn more about JSON and BSON in the MongoDB documentation.