Details
-
Bug
-
Resolution: Duplicate
-
Major - P3
-
None
-
2.4.9, 2.6.0-rc1
-
None
-
ALL
Description
This occurs in 2.4.9 and 2.6.0-rc1.
> db.a.insert({a: "foo"})
|
> db.a.find({a: /^abc+|foo/})
|
{ "_id" : ObjectId("53228d743704a19f9cb03ea6"), "a" : "foo" }
|
> db.a.ensureIndex({a: 1})
|
> db.a.find({a: /^abc+|foo/})
|
The problem is that simpleRegex returns success when it hits most metacharacters, and doesn't continue on to find the |.
I suggest that you check the entire regex first for | and immediately bail out with an empty string if it's find. (This is not 100% optimal because the | could have been escaped, but it's certainly correct.)
Attachments
Issue Links
- duplicates
-
SERVER-15235 Regex query returns incorrect results when index is present
-
- Closed
-