New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade 3.0 #164
Upgrade 3.0 #164
Conversation
…e moving from JavksonDBCollection easier. One test broken.
* The object mapper to use to serialise values | ||
* @return The object | ||
*/ | ||
public Document serialiseAndGetAsDocument(ObjectMapper objectMapper, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo - serialize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Darn. Will fix in the morning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be noted this is also mispelled in the existing (DBObject) method, but I think seriazeAndGet is meant for internal use only.
import org.mongojack.internal.stream.JacksonDecoder; | ||
import org.mongojack.internal.stream.JacksonEncoder; | ||
|
||
import javax.swing.text.Document; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Darn will fix in the morning. Should definitely be Bson.Document
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was actually left in from earlier testing... Safe to remove entirely.
private static final ObjectMapper DEFAULT_OBJECT_MAPPER = MongoJackModule | ||
.configure(new ObjectMapper()); | ||
|
||
private com.mongodb.client.MongoCollection<T> mongoCollection; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be final? do we need the fully specified package name or can we just import it instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't be final if we want to let users set WriteConcern or ReadConcern, unless we do the same thing as the Mongo driver here and return a new instance if the JacksonMongoCollection.
Fully specified package name is because there is already a class that has the same name in the package as the JacksonMongoCollection.
Remove unused items from JacksonCodecRegistry
|
||
public class JacksonEncoder<T> implements Encoder<T> { | ||
|
||
private Class<T> clazz; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can these variables be made final?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why not. I'll do it.
This seems like a big enough change that we should add something about how to use it to the README |
Adding to the README makes sense. I'll make a section, and add it to the PR. |
README updated. Please review. |
Is this updated to the Maven repo ? |
Yes, as of 2.8.1. |
This PR attempts to make MongoJack usable with the Mongo 3.0 driver conventions. MongoCollection instead of DBCollection. Document instead DBObject, etc...
Rough pass and could use more testing before being considered production ready. Tried to keep most methods from JacksonDBCollection in JacksonMongoCollection to make upgrading easy.
Usage example can be found in TestJacksonMongoCollection.