Why does MongoDB store data in the BSON format?
MongoDB uses BSON because this format is more convenient and faster for a database to work with than plain JSON.
Briefly, at a junior level
- Fast processing BSON is a binary format. It's easier for a computer to read binary data than text, so operations run faster.
- Extra data types
JSON has no types like
DateorObjectId. BSON supports them, which is handy for a database. - Compactness BSON takes up less disk space, so it loads into memory faster.
- Fast lookups BSON stores the length of documents and fields, so MongoDB can find the data it needs faster.
Summary: BSON makes MongoDB faster, more efficient, and more functional at working with documents than JSON would.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.