[SERVER-13092] shell bulk API replaceOne behaves like updateOne Created: 07/Mar/14  Updated: 19/Jun/23  Resolved: 19/Jun/23

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 2.6.4, 2.7.5
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Andreas Nilsson Assignee: [DO NOT ASSIGN] Backlog - Server Development Platform Team (SDP) (Inactive)
Resolution: Won't Do Votes: 0
Labels: 26qa, move-stm, sdp-backlog-purge
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to DOCS-10009 Comment on: "manual/reference/method/... Closed
related to SERVER-48780 bulkWrite() in mongo shell does not c... Closed
is related to SERVER-28383 Shell bulk.updateOne allows replacement Closed
Assigned Teams:
Server Development Platform
Operating System: ALL
Steps To Reproduce:

The following code should fail but instead it updates the

{a:0}

document.

var coll = db.foo;
var batch = coll.initializeOrderedBulkOp();
batch.insert({a:0});
batch.find({a:0}).replaceOne({$set: {b:2}});
var result = batch.execute();

Sprint: Build A (10/09/15), Build B (10/30/15)
Participants:

 Description   

According to the fluent API spec https://github.com/10gen/specifications/blob/master/source/driver-fluent-api.rst

replaceOne should always replace and never update a document. This should be ensured by checking that the new document is not prefixed with '$'.

This is currently not enforced in the shell bulk API implementation. replaceOne calls updateOne directly without any extra checks.



 Comments   
Comment by Alex Neben [ 19/Jun/23 ]

This has been identified as work that the SDP team won't do in the near term. Please reopen with a comment if you feel this work should be reprioritized and explain why.

Comment by Steven Vannelli [ 10/May/22 ]

Moving this ticket to the Backlog and removing the "Backlog" fixVersion as per our latest policy for using fixVersions.

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