summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorIan Boros <puppyofkosh@gmail.com>2019-04-23 12:53:10 -0400
committerIan Boros <puppyofkosh@gmail.com>2019-04-23 12:56:00 -0400
commit03a6b3f910e051624dd6b3065b5ee9ea3b6c6fb5 (patch)
tree7b847a779c9b8f2ae37c4b43bb9018a7d048395c /jstests
parentc3a2176d5124ef3dc160db2b9f85c698e1ca2664 (diff)
downloadmongo-03a6b3f910e051624dd6b3065b5ee9ea3b6c6fb5.tar.gz
Revert "SERVER-40083 Don't recompile each time $regex is evaluated when regex argument is a constant"
This reverts commit a60f6a53734fa3a022e9ba39bbdab95608ba9108.
Diffstat (limited to 'jstests')
-rw-r--r--jstests/aggregation/expressions/regex.js34
1 files changed, 4 insertions, 30 deletions
diff --git a/jstests/aggregation/expressions/regex.js b/jstests/aggregation/expressions/regex.js
index 90d6417c29d..618528ffa38 100644
--- a/jstests/aggregation/expressions/regex.js
+++ b/jstests/aggregation/expressions/regex.js
@@ -378,10 +378,9 @@
(function testMultipleMatches() {
coll.drop();
- assert.commandWorked(coll.insert({a: "string1string2", regex: "(string[1-2])"}));
- assert.commandWorked(coll.insert({a: "string3 string4", regex: "(string[3-4])"}));
- assert.commandWorked(coll.insert({a: "string5 string6", regex: "(string[3-4])"}));
- // All documents match.
+ assert.commandWorked(coll.insert({a: "string1string2"}));
+ assert.commandWorked(coll.insert({a: "string3 string4"}));
+ // Both match.
testRegexFindAgg({input: "$a", regex: "(str.*?[0-9])"}, [
{
"matches": [
@@ -394,41 +393,16 @@
{"match": "string3", "idx": 0, "captures": ["string3"]},
{"match": "string4", "idx": 8, "captures": ["string4"]}
]
- },
- {
- "matches": [
- {"match": "string5", "idx": 0, "captures": ["string5"]},
- {"match": "string6", "idx": 8, "captures": ["string6"]}
- ]
}
]);
// Only one match.
testRegexFindAgg({input: "$a", regex: "(^.*[0-2]$)"}, [
{"matches": []},
- {"matches": []},
{"matches": [{"match": "string1string2", "idx": 0, "captures": ["string1string2"]}]}
]);
// None match.
- testRegexFindAgg({input: "$a", regex: "(^.*[7-9]$)"},
- [{"matches": []}, {"matches": []}, {"matches": []}]);
-
- // All documents match when using variable regex.
- testRegexFindAgg({input: "$a", regex: "$regex"}, [
- {"matches": []},
- {
- "matches": [
- {"match": "string1", "idx": 0, "captures": ["string1"]},
- {"match": "string2", "idx": 7, "captures": ["string2"]}
- ]
- },
- {
- "matches": [
- {"match": "string3", "idx": 0, "captures": ["string3"]},
- {"match": "string4", "idx": 8, "captures": ["string4"]}
- ]
- }
- ]);
+ testRegexFindAgg({input: "$a", regex: "(^.*[5-9]$)"}, [{"matches": []}, {"matches": []}]);
})();
(function testInsideCondOperator() {