summaryrefslogtreecommitdiff
path: root/jstests/aggregation
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2015-11-04 12:30:15 -0500
committerMathias Stearn <mathias@10gen.com>2015-11-04 13:53:03 -0500
commitf79d18871869e1ae1591506c27c9e56b86bc7706 (patch)
treec40ec8b7e3fcbb6ad19385f19f27af8bd5c6624a /jstests/aggregation
parent93832192cc1e354a6b92ce34ee43dae85c62cefb (diff)
downloadmongo-f79d18871869e1ae1591506c27c9e56b86bc7706.tar.gz
SERVER-21287 $lookup should always make $eq queries
Diffstat (limited to 'jstests/aggregation')
-rw-r--r--jstests/aggregation/bugs/server19095.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/jstests/aggregation/bugs/server19095.js b/jstests/aggregation/bugs/server19095.js
index fdd0454ac47..d36dba74141 100644
--- a/jstests/aggregation/bugs/server19095.js
+++ b/jstests/aggregation/bugs/server19095.js
@@ -378,6 +378,31 @@ load("jstests/aggregation/extras/utils.js");
testPipeline(pipeline, expectedResults, coll);
//
+ // Query-like local fields (SERVER-21287)
+ //
+
+ // This must only do an equality match rather than treating the value as a regex.
+ coll.drop();
+ assert.writeOK(coll.insert({_id: 0, a: /a regex/}));
+
+ from.drop();
+ assert.writeOK(from.insert({_id: 0, b: /a regex/}));
+ assert.writeOK(from.insert({_id: 1, b: "string that matches /a regex/"}));
+
+ pipeline = [
+ {$lookup: {
+ localField: "a",
+ foreignField: "b",
+ from: "from",
+ as: "b",
+ }},
+ ];
+ expectedResults = [
+ {_id: 0, a: /a regex/, b: [{_id: 0, b: /a regex/}]}
+ ];
+ testPipeline(pipeline, expectedResults, coll);
+
+ //
// Error cases.
//