-
Notifications
You must be signed in to change notification settings - Fork 1.1k
DATAMONGO-1158 - Add Support for mongo-java-driver 3.0 #273
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
Conversation
Is the behavior change illustrated by MongoTemplateTests#throwsExceptionForDuplicateIds going to be an issue for users? Comparing the default profile (2.x driver) with mongo-3-next, I see that, although the test passes:
And if I change the test to do this regardless of driver version:
the behavior with the 2.x driver doesn't change, but with the 3.x driver it fails to throw an exception at all. Would you consider changing MongoTemplate such that if WriteResultChecking.EXCEPTION is enabled, and WriteConcern.w < 1, it's changed to WriteConcern.ACKNOWLEDGED? |
Thanks @jyemin good catch, seems I totally overlooked that one. Guess it would make sense to change the |
Just ran the tests against MongoDB Server 3.0-rc7 with |
A few quick observations:
Other than that: a great thank you to both @jyemin and @christophstrobl, looks like quite a way but a great achievement in the end :). |
Thanks @olivergierke. Already changed package assignment of reflective invokers, static imports and documentation. I was not sure about a dedicated |
@christophstrobl let me know if you want a second set of eyes for those failing tests. |
Prepare issue branch.
We now support mongo-java-driver version 2.x and 3.0 along with MongoDB Server 2.6.7 and 3.0.0. Pleaes note that some of the configurations options might no longer be valid when used with version 3 of the mongo-java-driver. Have a look at the table below so see some of the major differences in using version 2.x or 3.0 | 2.x | 3.0 ----------------------+-----------------------+----------------------------------------------- default WriteConcern | NONE | UNACKNOWLEDGED ----------------------+-----------------------+----------------------------------------------- option for slaveOk | available | ignored ----------------------+-----------------------+----------------------------------------------- option for autoConnect| available | ignored ----------------------+-----------------------+----------------------------------------------- write result checking | available | ignored (errors are exceptions anyway) ----------------------+-----------------------+----------------------------------------------- rest index cache | available | throws UnsupportedOperationException ----------------------+-----------------------+----------------------------------------------- DBRef resolution | via DBRef.fetch | via collection.findOne ----------------------+-----------------------+----------------------------------------------- MapReduce Options | applied | ignored ----------------------+-----------------------+----------------------------------------------- authentication | via UserCredentials | via MongoClient ----------------------+-----------------------+----------------------------------------------- WriteConcernException | not available | translated to DataIntegretyViolationException ----------------------+-----------------------+----------------------------------------------- executeInSession | available | requestStart/requestDone commands ignored. ----------------------+-----------------------+----------------------------------------------- index creation | via createIndex | via createIndex ----------------------+-----------------------+-----------------------------------------------
We now support mongo-java-driver version 2.x and 3.0 along with MongoDB Server 2.6.7 and 3.0.0. Pleaes note that some of the configurations options might no longer be valid when used with version 3 of the mongo-java-driver. Have a look at the table below so see some of the major differences in using version 2.x or 3.0. | 2.x | 3.0 ----------------------+-----------------------+----------------------------------------------- default WriteConcern | NONE | UNACKNOWLEDGED ----------------------+-----------------------+----------------------------------------------- option for slaveOk | available | ignored ----------------------+-----------------------+----------------------------------------------- option for autoConnect| available | ignored ----------------------+-----------------------+----------------------------------------------- write result checking | available | defaults WriteConncern to ACKNOWLEGED for EXCEPTION ----------------------+-----------------------+----------------------------------------------- rest index cache | available | throws UnsupportedOperationException ----------------------+-----------------------+----------------------------------------------- DBRef resolution | via DBRef.fetch | via collection.findOne ----------------------+-----------------------+----------------------------------------------- MapReduce Options | applied | ignored ----------------------+-----------------------+----------------------------------------------- authentication | via UserCredentials | via MongoClient ----------------------+-----------------------+----------------------------------------------- WriteConcernException | not available | translated to DataIntegretyViolationException ----------------------+-----------------------+----------------------------------------------- executeInSession | available | requestStart/requestDone commands ignored. ----------------------+-----------------------+----------------------------------------------- index creation | via createIndex | via createIndex ----------------------+-----------------------+-----------------------------------------------
We need to soften the exception validation a bit since the message is slightly different when using different storage engines in a MongoDB 3.0 environment.
* protected reflective invokers by moving them around. * undo static imports. * add usage notes to reference documentation.
3ec7901
to
d233e56
Compare
We added an explicit mongo-client element and client-options to the configuration schema. These elements will replace existing mongo and options elements in a subsequent release. Next we need to allow passing in credentials, so one is able to configure authentication for mongo-client.
d233e56
to
7f83ac4
Compare
Added credentials attribute to <monog-client> which allows to define a set of credentials used for setting up the MongoClient correctly using authentication data.
We now reject mongo-options configuration when using mongo-java-driver generation 3 and above.
b5739c5
to
7bfbc44
Compare
We now support mongo-java-driver version 2.x and 3.0 along with MongoDB Server 2.6.7 and 3.0.0. Please note that some of the configurations options might no longer be valid when used with version 3 of the MongoDB Java driver. Have a look at the table below so see some of the major differences in using version 2.x or 3.0 | 2.x | 3.0 ----------------------+----------------------+----------------------------------------------- default WriteConcern | NONE | UNACKNOWLEDGED ----------------------+----------------------+----------------------------------------------- option for slaveOk | available | ignored ----------------------+----------------------+----------------------------------------------- option for autoConnect| available | ignored ----------------------+----------------------+----------------------------------------------- write result checking | available | ignored (errors are exceptions anyway) ----------------------+----------------------+----------------------------------------------- rest index cache | available | throws UnsupportedOperationException ----------------------+----------------------+----------------------------------------------- DBRef resolution | via DBRef.fetch | via collection.findOne ----------------------+----------------------+----------------------------------------------- MapReduce Options | applied | ignored ----------------------+----------------------+----------------------------------------------- authentication | via UserCredentials | via MongoClient ----------------------+----------------------+----------------------------------------------- WriteConcernException | not available | translated to DataIntegretyViolationException ----------------------+----------------------+----------------------------------------------- executeInSession | available | requestStart/requestDone commands ignored. ----------------------+----------------------+----------------------------------------------- index creation | via createIndex | via createIndex ----------------------+----------------------+----------------------------------------------- We need to soften the exception validation a bit since the message is slightly different when using different storage engines in a MongoDB 3.0 environment. Added an explicit <mongo-client /> element and <client-options /> to the configuration schema. These elements will replace existing <mongo /> and <options /> elements in a subsequent release. Added credentials attribute to <mongo-client /> which allows to define a set of credentials used for setting up the MongoClient correctly using authentication data. We now reject <mongo-options /> configuration when using MongoDB Java driver generation 3.0 and above. Original pull request: #273.
MongoFactoryBean, MongoOptionsFactoryBean, MongoClientFactoryBean and MongoClientOptionsFactoryBean now extend AbstractFactoryBean to get a lot of the lifecycle callbacks without further code. Added non-null assertions to newly introduced methods on MongoOperations/MongoTemplate. Moved MongoClientVersion into util package. Introduced static imports for ReflectionUtils and MongoClientVersion for all references in the newly introduced Invoker types. Some formatting, JavaDoc polishes, suppress deprecation warnings. Added build profile for MongoDB Java driver 3.0 as well as the following snapshot. Original pull request: #273.
MongoFactoryBean, MongoOptionsFactoryBean, MongoClientFactoryBean and MongoClientOptionsFactoryBean now extend AbstractFactoryBean to get a lot of the lifecycle callbacks without further code. Added non-null assertions to newly introduced methods on MongoOperations/MongoTemplate. Moved MongoClientVersion into util package. Introduced static imports for ReflectionUtils and MongoClientVersion for all references in the newly introduced Invoker types. Some formatting, JavaDoc polishes, suppress deprecation warnings. Added build profile for MongoDB Java driver 3.0 as well as the following snapshot. Original pull request: #273.
I've squashed the commits, polished things a little and published a snapshot of the Mongo 3 specific docs we will publish alongside the release. Thanks again for kicking this off! |
We now support both mongo-java-driver 2.13 and 3.0 along with MongoDB Server 2.6.7 and 3.0.0.
Pleaes note that some of the configurations options might no longer be valid when used with version 3 of the mongo-java-driver. Have a look at the table below so see some of the major differences in using version 2.x or 3.0
This PR will actually not set the version for mongo-java-driver to any 3.0-SNAPSHOT but will remain using 2.13.0. Please run
mvn clean install -P mongo-3-next
to build against lastest mongo-java-driver snapshots.This pull request should supersed #269 (thanks @jyemin kicking this off - has been an invaluable help!)