Question 2 / 50
MongoDB stores documents. How is BSON different from JSON, and why does that matter?
Short answer
BSON is a binary encoding of JSON-like documents. It adds types JSON cannot represent — ObjectId, Date, Decimal128, binary — and it is length-prefixed so the server can skip fields without parsing them.
Why?
Because BSON is typed, an integer comes back as an integer rather than a float, and dates round-trip without string parsing. Length prefixes make it cheap to walk into a nested field. The trade-off is size: BSON is usually slightly larger than the equivalent JSON because of type and length metadata.
Interview tip
Mentioning Decimal128 for money is a strong signal — it shows you have thought about float precision in a real system.
Common mistake
Calling BSON 'just compressed JSON'. Compression is separate; BSON is about types and traversal.
How did you do?
Cheat Sheet