parsing bson

21 views
Skip to first unread message

Hermann Norpois

unread,
Jul 2, 2015, 9:08:40 AM7/2/15
to mongod...@googlegroups.com
Hello,

I am interested how mongodb parses bson documents. I found that libbson is used but did not find libbson on my system  (Maybe I am using an older version?
I am using v2.0.4 on ubuntu 14.04). Thus, there must be an alternative to libbson. Can anybody give me a hint?
Thanks
Hermann

Stephen Steneker

unread,
Jul 2, 2015, 10:05:13 AM7/2/15
to mongod...@googlegroups.com, hnor...@gmail.com
On Thursday, 2 July 2015 23:08:40 UTC+10, Hermann Norpois wrote:
I am interested how mongodb parses bson documents. I found that libbson is used but did not find libbson on my system  (Maybe I am using an older version?
I am using v2.0.4 on ubuntu 14.04). Thus, there must be an alternative to libbson. Can anybody give me a hint?

Hi Hermann,

if you want to understand the BSON format better, the spec is public and very straightforward: http://bsonspec.org.

There are multiple libraries that implement BSON parsers:

 - The C library libbson is intended as a utility library for client drivers (in particular for those languages that support C extensions): https://github.com/mongodb/libbson 

 - Most of the MongoDB drivers still use their own implementation of BSON serialization (although some do use libbson now)

 - The server code has its own use C++ implementation of BSON parsing: https://github.com/mongodb/mongo/tree/v3.0/src/mongo/bson

If you want to better understand the nuances of robustly parsing BSON, the libbson test suite is an interesting starting point:
 https://github.com/mongodb/libbson/tree/master/tests

Regards,
Stephen
Reply all
Reply to author
Forward
0 new messages