[DOCS-13923] Investigate changes in SERVER-51362: Ensure that update and delete shell helpers support 'let' variables Created: 09/Oct/20  Updated: 09/Oct/20  Resolved: 09/Oct/20

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: 4.9.0

Type: Task Priority: Major - P3
Reporter: Backlog - Core Eng Program Management Team Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
documents SERVER-51362 Ensure that update and delete shell h... Closed
Participants:
Days since reply: 3 years, 17 weeks, 5 days ago

 Description   

Description

Downstream Change Summary

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.)



 Comments   
Comment by Jeffrey Allen [ 09/Oct/20 ]

This work is being handled by jason.price as part of DOCS-13620

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