Explaining BSON with Examples
FAQs
Yes. They can contain null values.
BSON has various data types which are not included in JSON, such as Date for datetime and ObjectID.
BSON is a binary-encoded serialized format of JSON documents. It provides type and length information in characters that are not human-readable but make it easier for machines to parse.
{"hello": "world"} →
\x16\x00\x00\x00 // total document size
\x02 // 0x02 = type String
hello\x00 // field name
\x06\x00\x00\x00world\x00 // field value
\x00 // 0x00 = type EOO ('end of object')
BSON is easier to generate and parse for machines and also supports more data types than JSON.
Get started with Atlas today
- 125+ regions worldwide
- Sample data sets
- Always-on authentication
- End-to-end encryption
- Command line tools