[SERVER-15119] Accept a named "writeConcern" option for bulk.execute Created: 02/Sep/14  Updated: 20/Nov/23  Resolved: 20/Nov/23

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

Type: Improvement Priority: Minor - P4
Reporter: Scott Hernandez (Inactive) Assignee: Backlog - Storage Execution Team
Resolution: Gone away Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-13113 shell API does not validate write con... Backlog
is related to SERVER-13156 wc validation in shell bulk API is no... Closed
is related to SERVER-15117 Bulk write with invalid writeConcern ... Closed
Assigned Teams:
Storage Execution
Participants:

 Description   

Currently this doesn't generate an error, or work as intended, since gle on the server ignores it, but we should be able to tell what the user intended and use it correctly.

var bulk = ...
...
bulk.execute({w:1}) // correct format
bulk.execute({writeConcern:{w:1}}) // should work by unwrapping "writeConcern"

This will also allow execute to have more named arguments in the future...



 Comments   
Comment by Steven Vannelli [ 20/Nov/23 ]

This is for the legacy shell so closing as won't fix.

Comment by Scott Hernandez (Inactive) [ 02/Sep/14 ]

Basically what I'm suggesting is adding below this https://github.com/mongodb/mongo/blob/master/src/mongo/shell/bulk_api.js#L1116, this:

if (writeConcern.writeConcern) {
 if (writeConcern.keySet().size == 1) {
  writeConcern = writeConcern.writeConcern; // unwrap writeConcern into the thing to send to the server
 } else { throw Error("bad arg: " + writeConcern); }
}

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