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

XMLWordPrintableJSON

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

      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:
              DO NOT USE - Backlog - Platform Team
              Reporter:
              Kamran K. (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: