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

Bulk API should prevent additional operations from being added after execute() is run

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.6.0-rc2
    • Component/s: Shell

      The bulk API should raise an exception if find() or insert() is used after execute(). The existing Bulk object will not run those additional operations because execute() can only be run once.

      Example run:

      > var bulk = db.foo1.initializeUnorderedBulkOp()
      > bulk.insert({})
      > bulk.execute()
      BulkWriteResult({
      	"writeErrors" : [ ],
      	"writeConcernErrors" : [ ],
      	"nInserted" : 1,
      	"nUpserted" : 0,
      	"nMatched" : 0,
      	"nModified" : 0,
      	"nRemoved" : 0,
      	"upserted" : [ ]
      })
      > bulk.find({}).removeOne()
      > bulk.execute()
      2014-03-31T18:22:50.694-0400 Error: A bulk operation cannot be re-executed at src/mongo/shell/bulk_api.js:1093
      

      Version: a12d09c9757301c3872cf4b45027d287e3dcc366

            Assignee:
            backlog-server-platform DO NOT USE - Backlog - Platform Team
            Reporter:
            kamran.khan Kamran K.
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: