Improved MongoDB compatibility for bson4jackson
source link: https://michelkraemer.com/improved-mongodb-compatibility-for-bson4jackson/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
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 which can be registered to Jackson’s ObjectMapper
:
ObjectMapper om = new ObjectMapper(new BsonFactory());
om.registerModule(new BsonUuidModule());
Thanks to the contribution by James Roper the BsonParser
class now supports the new HONOR_DOCUMENT_LENGTH
feature which makes the parser honor the first 4 bytes of a document which usually contain the document’s size. Of course, this only works if BsonGenerator.
Feature.
ENABLE_STREAMING
has not been enabled during document generation.
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.
More information
For a complete description of bson4jackson (including how to download it) have a look at my tutorial.
Next post
bson4jackson 2.0 has just been released!
Version 2.0 of bson4jackson has just been released. bson4jackson adds support for BSON, a binary representation of JSON, to the Jackson JSON processor. The…
Previous post
Build Scala projects with Eclipse Buckminster
In one of my previous posts I talked about how to build Scala projects with PDE Build. However, PDE Build is rather old and has long been superseded by…
Related posts
Binary JSON with bson4jackson
Recently, JSON has become an excellent alternative to XML. But most JSON parsers written in Java are still rather slow. On my search for faster libraries I found two…
bson4jackson 2.11.0
I’m delighted to announce a new version of bson4jackson 2.11.0. The library is already very stable and there haven’t been many updates recently. The latest version…
bson4jackson 2.9.2
It’s been a while since I posted updates on bson4jackson here on this blog, so now that version 2.9.2 has just been released, I figured it would be a good idea…
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK