[SERVER-46998] Support 'let' variables used within $merge custom pipeline update Created: 19/Mar/20 Updated: 29/Oct/23 Resolved: 18/May/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | None |
| Fix Version/s: | 4.7.0 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Charlie Swanson | Assignee: | Katherine Wu (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | qopt-team | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||
| Sprint: | Query 2020-05-18, Query 2020-06-01 | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Description |
|
Here we're talking about a $merge stage which uses the pipeline option for 'whenMatched'. If that custom pipeline references a variable defined in the 'let' parameter to the aggregate command, it should work just fine. Split fromĀ |
| Comments |
| Comment by Githook User [ 18/May/20 ] | |||||
|
Author: {'name': 'Katherine Wu', 'email': 'katherine.wu@mongodb.com', 'username': 'kaywux'}Message: | |||||
| Comment by Charlie Swanson [ 03/Apr/20 ] | |||||
|
Correct. All 'let' behaviors will remain unaffected, it will follow the same scoping rules as usual. Same as for $lookup which also has a 'let' option. The innermost definition wins, much like in programming. As a concrete example:
Will use the value "INNER" inside the 'whenMatched' pipeline. If "$$demo" were used in some other stage, it would take the value "OUTER". | |||||
| Comment by Asya Kamsky [ 03/Apr/20 ] | |||||
|
$merge supports its own let option - will that remain unchanged? if so will it mask pipeline level defined let variables? |