What is BSON?
BeginnerConceptMongoDB
Answer
Short answer
BSON (Binary JSON) is the binary format MongoDB uses to store documents on disk and send them over the network. It looks like JSON to you, but it's faster to parse and supports extra types that JSON lacks — like ObjectId, Date, Decimal128, Int64 and binary data.
Example
{
_id: ObjectId("6650f1c2a7b3e4d5f6a7b8c9"), // 12-byte id
createdAt: ISODate("2026-11-26T10:15:00Z"), // real date type
total: NumberDecimal("52000.50"), // exact decimal for money
qty: NumberInt(3)
}
Why it matters
- Store money as
Decimal128, not floating point, to avoid rounding errors. - Store dates as real dates so range queries and TTL indexes work.
mongodumpwrites .bson files;mongoexportwrites human-readable JSON/CSV (but loses some type information).
What to say in the interview
"BSON is MongoDB's binary JSON encoding — efficient to traverse, with extra types like ObjectId, Date and Decimal128. That's why we use mongodump for backups, since it preserves types, and mongoexport only for human-readable exports."
More on MongoDB
What is MongoDB and how is it different from MySQL or PostgreSQL?BeginnerHow do you run MongoDB, log in and work with data?BeginnerWhat is a NoSQL database?BeginnerWhat is a document and a collection in MongoDB?BeginnerWhat is the _id field and what is an ObjectId?BeginnerHow do you connect to MongoDB and explore databases and collections?Beginner