Thursday, July 14, 2011

Understanding BSON

BSON stands for Binary JSON. The difference between JSON and BSON is that BSON is like binary representation of JSON document or more like serialization i.e to convert JSON document to serialized document with some extra characters. This way BSON supports data structure types that are not available in JSON, like BinData type.

BSON is lightweight, traversable (used in MongoDB), efficient.

BSON in many cases has larger size than JSON document so why should we use it?

Well it the main goal for this is the traversability i.e faster processing. When creating BSON document in the code some extra data is added like length prefixes so that it is much more easier to decode it. Also integer numbers are stored as 32 bit integer so that there is no need of processing text . Thats why it is much faster but it takes more place.

You might wanna visit BSON . Also visit the specifications page. 

In the next post I will talk about implementing the MongoDB and installing php drivers.

1 comment:

  1. Thanks so much :)

    BSON is a quite powerful stuff. It is designed for performance which MongoDB utilizes to store and manipulate its data. In the next article I will post something on installing MongoDB and how to create and manipulate data in it.

    ReplyDelete