Skip to content

Updates to work with the 3.0.x branch of the Java driver #269

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

Closed
wants to merge 24 commits into from

Conversation

jyemin
Copy link
Contributor

@jyemin jyemin commented Jan 21, 2015

There are a few failing tests, but this is pretty close to working. Please see individual commits for specific issues.

The biggest remaining problem relates to checking the results of a write. From what I can see MongoTemplate currently forces the acknowledgement of every write, regardless of the write concern in play. This is due to the explicit call by MongoTemplate to WriteResult.getError() (which have been deprecated in 2.13 and removed in 3.0) after each write, and also by the call to WriteResult.getN() after each update.

Given that current behavior, one option is to instead force acknowledgment by using WriteConcern.ACKNOWLEDGED as the minimum write concern. Doing this lets the driver apply the write concern at the same time as the write, which is the only option you have in 3.0 and more efficient in 2.x as well.

I realize now that I didn't fully follow the contributing guidelines. I will fix that and rebase if this looks like something that you'll eventually accept.

jyemin added 24 commits January 21, 2015 17:54
…ding method has been removed from the 3.0 driver
…er no longer adds that field to the raw results.
…replacing them with the ones that they currently extend.
…om the 3.0 driver, and deprecated MongoTemplate.executeInSession
…en removed in the 3.0 driver. Replaced with use of DB.command method that takes a ReadPreference,

and added a new public method to MongoTemplate to match.
…, which has been removed from the 3.0 driver.

This needs to be addresses, as it's a silently breaking change.
…teResultErrors method.

The reason is that if there was a write error, the driver would not have returned a WriteResult: it would have thrown an exception.
A WriteResult would only be returned for a failed write if the WriteConcern was unacknowledged, in which case a call to WriteResult.getError
is not the right thing to do, as it's forcing the write to be acknowledged, which essentially ignores the write concern.
… been removed from the 3.0 driver,

and changed MongoTemplate.mapReduce to use DBCollection.mapReduce instead of DB.command.

This introduces a few minor issues:

1. MapReduceOptions.extraOptions is silently ignored
2. MapReduceResults.timing property is no longer correct
3. The raw mapReduce command is no longer logged
@jyemin
Copy link
Contributor Author

jyemin commented Jan 22, 2015

Also wanted to note that this branch has some test failures that will be resolved once the next 3.0.0-SNAPSHOT is pushed to Sonatype. Just need to get past some build failures on our CI server, but hopefully by the end of the day it will be up.

@christophstrobl
Copy link
Member

Thanks @jyemin we've opend DATAMONGO-1158 for this one and are actively looking into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants