Answer: BSON is a binary-encoded serialization of JSON-like documents. BSON is designed to be lightweight, traversable, and efficient. BSON, like JSON, supports the embedding of objects and arrays within other objects and arrays.BSON supports all JSON types (objects, arrays, strings, integers, etc). BSON supports some additional types, most notably binary data, making it a superset of JSON.
The two major benefits of BSON over JSON are size and speed. BSON stores binary data directly, avoiding the time overhead and the additional size of base64 encoded text that regular JSON has with binary data. Reading and writing BSON is also faster than JSON.
Example :
{"hello": "world"} ? "\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00"
For more Details :
http://bsonspec.org/
Asked In: Many Interviews |
Alert Moderator