-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.4.9
-
Component/s: Querying
-
None
-
ALL
-
-
Query 2018-01-15
With a simple set of documents:
- {_id: 1, f1: "realapp"}
- {_id: 2, f1: "rea"}
- {_id: 3, f1: "rea\napp"}
- {_id: 4, f1: "rea\nlapp"}
- {_id: 5, f1: "suretrea"}
these two $regex expressions (identical except for use of quotes or slashes):
- find({f1:{$regex:'rea \n# comment 1\nl',$options:"x"}})
- find({f1:{$regex:/rea \n# comment 1\nl/,$options:"x"}})
give different results, both incorrect, despite our $regex documentation suggesting that the syntaxes with the search strings wrapped in quotes or slashes are equivalent.
Removing the option:x, the comment and the space leads to correct results from both forms.
- is duplicated by
-
SERVER-32355 Use of options:x and comments with $regex search including \n can lead to incorrect documents being returned
- Closed
- is related to
-
SERVER-30986 Server should error on invalid regex match expressions
- Closed