Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-21093

Ordered bulk insert operation don't act as ordered

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.2.0-rc1
    • Affects Version/s: None
    • Component/s: Write Ops
    • None
    • Fully Compatible
    • ALL
    • QuInt B (11/02/15)

      The behaviour of ordered bulk operations has changed since 3.2.0-rc0.

      Previously, if an ordered bulk operation failed then it stopped there, but it now inserts more.

      Given the following test case more inserts are being inserted than in previous versions:

      db.test.drop();
      db.test.insert({_id: 50});  // Create a document to force a duplicate key exception.
      
      var bulk = db.test.initializeOrderedBulkOp();
      for (i = 1; i < 100; i++) { 
        bulk.insert( { _id: i } );
      }
      try {
        bulk.execute();
        assert(false, "should have failed due to duplicate key");
      } catch(err) {
        assert(db.test.count() == 50, "Unexpected number inserted by bulk write");
      }
      

            Assignee:
            martin.bligh Martin Bligh
            Reporter:
            ross@mongodb.com Ross Lawley
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: