diff options
Diffstat (limited to 'jstests/aggregation/bugs/server5782.js')
-rw-r--r-- | jstests/aggregation/bugs/server5782.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/jstests/aggregation/bugs/server5782.js b/jstests/aggregation/bugs/server5782.js new file mode 100644 index 00000000000..d4ac2eeb6f1 --- /dev/null +++ b/jstests/aggregation/bugs/server5782.js @@ -0,0 +1,18 @@ +load('jstests/aggregation/extras/utils.js'); + +db.server5782.drop(); +db.server5782.save({string: "foo"}); + +// check that without $literal we end up comparing a field with itself and the result is true +var result = db.runCommand({aggregate: "server5782", + pipeline:[{$project: + {stringis$string: {$eq:["$string", '$string']}} + }]}); +assert.eq(result.result[0].stringis$string, true); + +// check that with $literal we end up comparing a field with '$string' and the result is true +var result = db.runCommand({aggregate: "server5782", + pipeline:[{$project: + {stringis$string: {$eq:["$string", {$literal:'$string'}]}} + }]}); +assert.eq(result.result[0].stringis$string, false); |