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.
DOCS-2813 Shell Bulk API additions