diff options
Diffstat (limited to 'jstests/core')
-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"}]); }()); |