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

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor - P4
    • Resolution: Unresolved
    • Affects Version/s: 2.6.0-rc2
    • Fix Version/s: Backlog
    • Component/s: Shell
    • Labels:

      Description

      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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated: