-
Type: Task
-
Resolution: Duplicate
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
Description
This provides 'let' parameter support in the update and remove shell helpers to mirror the let variable support in the update and delete server commands.
Description of Linked Ticket
The update command supports let parameters, but the db.collection.update() shell helper does not.
The following update command works:
db.runCommand({
update: db.cakeSales.getName(),
updates: [
{q: {$expr: {$eq: [“$salesTotal”, “$$targetTotal”], u: [{$set: {salesTotal: “$$newTotal”}}]}
],
let : {targetTotal: 2150, newTotal: 2155}
});
But the corresponding command using the shell helper fails with errmsg: “Use of undefined variable: targetTotal”.
db.cakeSales.update(
{$expr: {$eq: [“$salesTotal”, “$$targetTotal”],
{$set: {salesTotal: “$$newTotal”,
{let : {targetTotal: 4350, newTotal: 4200}}
);
Scope of changes
Impact to Other Docs
MVP (Work and Date)
Resources (Scope or Design Docs, Invision, etc.)
- documents
-
SERVER-51362 Ensure that update and delete shell helpers support 'let' variables
- Closed