[SERVER-12995] Updating docs with bulk API does not affect nModified Created: 03/Mar/14  Updated: 10/Dec/14  Resolved: 03/Mar/14

Status: Closed
Project: Core Server
Component/s: Shell, Write Ops
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Andreas Nilsson Assignee: Unassigned
Resolution: Done Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to DOCS-2813 Shell Bulk API additions Closed
Operating System: ALL
Steps To Reproduce:

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" : [ ]
}

Participants:

 Description   

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



 Comments   
Comment by Andreas Nilsson [ 03/Mar/14 ]

The issue was that I was using smoke.py which by default does not use write commands. Providing the --use-write-commands flag to smoke.py or using

--writeMode commands

to the shell will make it operate with write commands.

However I find it rather confusing that nModified means different things depending on the mode the server and shell operates in. This should probably be documented in the shell bulk API section.

Generated at Thu Feb 08 03:30:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.