[JAVA-427] Support ContinueOnError Flag for bulk insert Created: 31/Aug/11  Updated: 25/Jun/13  Resolved: 05/Sep/11

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: None
Fix Version/s: 2.7

Type: New Feature Priority: Major - P3
Reporter: Brendan W. McAdams Assignee: Brendan W. McAdams
Resolution: Done Votes: 0
Labels: SERVER_V2
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends

 Description   

When this flag is set, bulk insert will continue to insert any remaining documents even if an insert fails (due, for example, to a duplicate key). getLastError will report whether any doc inserts have failed (not just last one). If multiple errors occur, only the most recent will be reported by getLastError.



 Comments   
Comment by Pawel [ 25/Oct/12 ]

Yep, something like that would do it.

Comment by Jeffrey Yemin [ 25/Oct/12 ]

Yes, I noticed that too. We could add some fluent helpers to WriteConcern
to make it easier. Something like:

WriteConcern wc = WriteConcern.SAFE.continueOnInsertError(true)

Comment by Pawel [ 25/Oct/12 ]

Yep, found it.
It's a bit inconvenient, though. One has to clone a concern (may be a named concern), individually copying all the fields, and setting this flag too.

Comment by Jeffrey Yemin [ 25/Oct/12 ]

I'd have to track down the history, but it looks like this setting moved to the WriteConcern class: http://api.mongodb.org/java/2.9.2/com/mongodb/WriteConcern.html#WriteConcern(int, int, boolean, boolean, boolean)

Comment by Pawel [ 25/Oct/12 ]

I'm looking at the latest API doc (http://api.mongodb.org/java/2.9.2/com/mongodb/DBCollection.html), and I don't see that fix in there

Comment by auto [ 31/Aug/11 ]

Author:

{u'login': u'bwmcadams', u'name': u'Brendan W. McAdams', u'email': u'brendan@10gen.com'}

Message: JAVA-427 - Support ContinueOnError Flag for bulk insert

Generated at Thu Feb 08 08:52:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.