diff options
author | Katherine Wu <katherine.wu@mongodb.com> | 2021-06-10 13:49:19 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-06-14 21:38:33 +0000 |
commit | 19572bcc17bf07c391a2248e0dd52bc08d207fcd (patch) | |
tree | 61dbdf1ac44a2b3be8657b29b2709ebc738faabb /jstests/core/command_let_variables.js | |
parent | 431106074ec36920816a002296f10d44fdf9d971 (diff) | |
download | mongo-19572bcc17bf07c391a2248e0dd52bc08d207fcd.tar.gz |
SERVER-57403 Serialize 'let' variables by wrapping with $literal
Diffstat (limited to 'jstests/core/command_let_variables.js')
-rw-r--r-- | jstests/core/command_let_variables.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/jstests/core/command_let_variables.js b/jstests/core/command_let_variables.js index 208a0801530..6a3de698291 100644 --- a/jstests/core/command_let_variables.js +++ b/jstests/core/command_let_variables.js @@ -536,4 +536,11 @@ assert.between(0, result, 1); const deduped = [...new Set(values)]; assert.eq(1, deduped.length, `Expected all identical values: ${deduped}`); } + +// Test that expressions wrapped with $literal are serialized correctly when run in sharded cluster +// environments. +result = coll.aggregate([{$match: {$expr: {$eq: ["$_id", 2]}}}, {$project: {a: "$$b"}}], + {let : {b: {$literal: "$notAFieldPath"}}}) + .toArray(); +assert.eq(result, [{_id: 2, a: "$notAFieldPath"}]); }()); |