Updating your java
By default, this relies on Jackson; it respects document structure, handles lists and ignores missing attributes.
It just need a no-arg constructor, even private (if the object has to be immutable, .
For fine grained control over (un)marshalling, configure Jongo mapper or create your own.
Jongo comes with a custom Jackson configuration that can be extended.
DB db = new Mongo()DB("dbname"); Jongo jongo = new Jongo(db, new Jackson Mapper.
Builder() .register Module(new Joda Module()) .enable(Mapper Feature. Public.class) .build() ); attribute will be ignored even if it exists in Mongo.
Careful, when no view is defined, Jackson ignore annotations — which means every attribute is visible.
Views can be used for marshalling-only or unmarshalling-only if needed.
Jongo relies upon Jackson 2.7.3, Bson4Jackson 2.7.0 and Mongo Java Driver 3.0 .