Bson is a data format developed by 10gen, currently mainly used in MongoDB, is the MONGODB data storage format. Bson based on the JSON format, the main reason for choosing JSON for transformation is the versatility of JSON and the schemaless characteristics of JSON.
Bson will mainly achieve the following three goals: 1. Faster traversal speed
For the JSON format, too large a JSON structure can cause data traversal to be very slow. In JSON, to skip a document for data reading, you need to scan the document for a troublesome data structure match, such as a brace match, and Bson's big improvement to JSON is that it will have the element's head in the length of each element of JSON, This way you only need to read the length of the element to direct seek to the specified point for reading. 2. More simple Operation
For JSON, the data store is untyped, such as if you want to modify a basic value, from 9 to 10, because from one character to two, all the content behind it may need to be moved backwards. And using Bson, you can specify this column as a number, so regardless of whether the number from 9 to 10 or 100, we are only in the number of the store to modify, does not cause the total data grow larger. Of course, in MongoDB, if the number is increased from the shape to the long integer, it will still cause the total length of the data to become larger. 3. Additional data types are added
JSON is a convenient format for data interchange, but its type is relatively limited. Bson adds a "byte array" data type on its basis. This makes binary storage no longer needed to base64 the conversion before saving it as JSON. Greatly reduces the computational overhead and data size.
Of course, in some cases, Bson has no space advantage over JSON, for example, to {"Field": 7}, 7 uses only one byte in JSON storage, and if you use Bson, that's at least 4 bytes (32 bits).
At present, with the effort of 10gen, Bson has a codec pack for multiple languages. And all are Apache 2 license under the open source. And it is further developed with MongoDB. About Bson,