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

Updating docs with bulk API does not affect nModified

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Shell, Write Ops
    • Labels:
    • ALL
    • Hide
      db.coll.drop();
      var batch = db.coll.initializeOrderedBulkOp();
      batch.insert({a:1})
      batch.find({a:1}).updateOne({$set: {b:1}});
      batch.find({a:1}).update({$set: {b:2}});
      var result = batch.execute();
      

      returns

      {
      "writeErrors" : [ ],
      "writeConcernErrors" : [ ],
      "nInserted" : 1,
      "nUpserted" : 0,
      "nMatched" : 2,
      "nModified" : 0,
      "nRemoved" : 0,
      "upserted" : [ ]
      }
      
      Show
      db.coll.drop(); var batch = db.coll.initializeOrderedBulkOp(); batch.insert({a:1}) batch.find({a:1}).updateOne({$set: {b:1}}); batch.find({a:1}).update({$set: {b:2}}); var result = batch.execute(); returns { "writeErrors" : [ ], "writeConcernErrors" : [ ], "nInserted" : 1, "nUpserted" : 0, "nMatched" : 2, "nModified" : 0, "nRemoved" : 0, "upserted" : [ ] }

      Inserting and updating documents to an empty collection does not update the nModified return value.

            Assignee:
            Unassigned Unassigned
            Reporter:
            andreas.nilsson Andreas Nilsson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: