Improved MongoDB compatibility for bson4jackson
Version 1.2.0 of bson4jackson has just been released. bson4jackson adds support for BSON, a binary representation of JSON, to the Jackson JSON processor. Thanks to contributions from the community, the latest release of bson4jackson now includes better support for MongoDB.
Gergő Ertli has fixed the support for the
ObjectId type. Object IDs are used as the primary key for MongoDB documents.
Support for the
UUID type has been added by Ed Anuff.
He added a new module that can be registered with Jackson’s
ObjectMapper om = new ObjectMapper(new BsonFactory()); om.registerModule(new BsonUuidModule());
Thanks to the contribution by James Roper
BsonParser class now supports the new
feature, which makes the parser honour the first 4 bytes of a document that
usually contain the document’s size. Of course, this only works if
ENABLE_STREAMING has not been enabled during
This feature can be useful for reading consecutive documents from an input stream produced by MongoDB. You can enable it as follows:
BsonFactory fac = new BsonFactory(); fac.enable(BsonParser.Feature.HONOR_DOCUMENT_LENGTH); BsonParser parser = (BsonParser)fac.createJsonParser(...);
Apart from that, a lot of other minor bugs have been fixed. The library has been tested with Jackson 1.7 up to 1.9.
For a complete description of bson4jackson (including how to download it), have a look at my tutorial.
Posted by Michel Krämer
on 17 December 2011
I’m excited to announce bson4jackson 2.0! The new version supports Jackson 2.0. Also, with a little help from the community, a few bugs have been fixed. Upgrading is recommended for all users.
This post introduces the open-source library bson4jackson, which is an extension to the Jackson JSON processor. It enables you to parse and generate documents in a binary JSON format called BSON.
This blog post summarizes the changes that came with the latest bson4jackson
updates. Highlights are support for
Decimal128, refactored serializers and
deserializers, as well as support for Jackson 2.8 and 2.9.
This version is a maintenance release that updates Jackson and fixes
some minor issues. Performance of the UTF-8 decoder has been improved
and precision of
BigDecimals has been increased. Updating is recommended
for all users.