summaryrefslogtreecommitdiff
path: root/jstests/core/command_let_variables.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/command_let_variables.js')
-rw-r--r--jstests/core/command_let_variables.js7
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"}]);
}());