Java Driver
  1. Java Driver
  2. JAVA-427

Support ContinueOnError Flag for bulk insert

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major - P3 Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.7
    • Component/s: API
    • Labels:
    • # Replies:
      6
    • Last comment by Customer:
      true

      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.

        Issue Links

          Activity

          Hide
          auto
          added a comment -

          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

          Show
          auto
          added a comment - 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 Added flags for continueOnError Test to verify bulk insert behaves as expected both with & without continueOnError enabled. Branch: master https://github.com/mongodb/mongo-java-driver/commit/7b03ea0a875a382c5bf1323af88cf7b8fdc009d6
          Hide
          Pawel
          added a comment -

          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

          Show
          Pawel
          added a comment - 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
          Hide
          Jeff Yemin
          added a comment -

          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)

          Show
          Jeff Yemin
          added a comment - 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)
          Hide
          Pawel
          added a comment -

          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.

          Show
          Pawel
          added a comment - 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.
          Hide
          Jeff Yemin
          added a comment -

          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)

          Show
          Jeff Yemin
          added a comment - 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)
          Hide
          Pawel
          added a comment -

          Yep, something like that would do it.

          Show
          Pawel
          added a comment - Yep, something like that would do it.

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                1 year, 24 weeks, 6 days ago
                Date of 1st Reply: