-
Type:
Bug
-
Resolution: Done
-
Priority:
Minor - P4
-
Affects Version/s: 2.5.1
-
Component/s: None
-
None
-
Environment:OSX, master built at revision 6e28cfc.
-
Fully Compatible
-
ALL
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
On Mongo 2.4.4:
> db.y.insert(
{a:'foo'})
> db.y.findOne({a: {$regex: /O/i}})
On master:
> db.y.insert(
{a: 'foo'})
> db.y.findOne({a: {$regex: /O/i}})
null
This only happens if you use `$regex` and you put the options directly on the BSON regex. `
{a: /O/i}` and `{$regex: 'O', $options: 'i'}` have the same behavior as in 2.4.
This is presumably because in `expression_parser.cpp` in `MatchExpressionParser::_parseRegexDocument`, if `$regex` points to a `RegEx`, we only look at its `regex()` and not at its `regexFlags()` too.