[SERVER-11771] extended options for $regex cannot be displayed in explain output when used on an index Created: 18/Nov/13 Updated: 01/May/18 Resolved: 25/Apr/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Luke Lovett | Assignee: | DO NOT USE - Backlog - Platform Team |
| Resolution: | Done | Votes: | 2 |
| Labels: | 26qa, nqf | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||||||||||
| Steps To Reproduce: |
|
||||||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||||||||||||||||||||
| Description |
|
Using extended $options for $regex (i.e. "x" or "s") does not work with explain output. Instead, we get the following error:
It looks like there is an attempt at converting the $regex:... , $options:... format of a mongo regular expression into the javascript /.../ regular expression format when formatting the explain output, but the non-standard flags can't be appended to this. |
| Comments |
| Comment by Asya Kamsky [ 25/Apr/18 ] | ||||||||||||||||||||
|
Seems fixed as of 3.5.1, closing. | ||||||||||||||||||||
| Comment by Asya Kamsky [ 20/Mar/17 ] | ||||||||||||||||||||
|
This is still broken in 3.4 but appears to be fixed in 3.5.1 | ||||||||||||||||||||
| Comment by Amar Hamzeh [ 22/Feb/17 ] | ||||||||||||||||||||
|
I think this can happen anywhere the shell attempts to deserialise BSON Regex elements. For example, the same issue happens when querying system.profile for operations that used a regex with flag "s" Reproduction Steps: 1. Enable profiling db.setProfilingLevel(1, -1)
3. Query the system.profile collection for that find operation, e.g.
If we query the same thing with Python, it works:
The field execStats.filter.a is where BSON Regex type is returned by the server. I have tested this with 3.2.11 and 3.4.1 | ||||||||||||||||||||
| Comment by Tyler Brock [ 25/Nov/13 ] | ||||||||||||||||||||
|
Hey Luke, This happens because some options that we support in the server are not actually supported by the RegExps in JavaScript. Specifically, the JS RegExp supports "i" and "m" but not the "s" or "x" options. To fix this problem we would need to create a custom FunctionTemplate (class) for these types of objects in the shell. Unfortunately, this would be backward breaking as the RegExp objects would no longer be usable directly without delegating the RegExp functionality. This warrants additional discussion about how to address the issue. | ||||||||||||||||||||
| Comment by Daniel Pasette (Inactive) [ 19/Nov/13 ] | ||||||||||||||||||||
|
Against a 2.4.8 shell this actually crashes the shell, so 2.5 behavior is actually an improvement....
| ||||||||||||||||||||
| Comment by Luke Lovett [ 19/Nov/13 ] | ||||||||||||||||||||
|
I can repro this on the 2.5.3 shell connecting to the 2.5.4 version of mongod. | ||||||||||||||||||||
| Comment by Daniel Pasette (Inactive) [ 19/Nov/13 ] | ||||||||||||||||||||
|
i believe this is set in the v8 code here: src/third_party/v8/src/jsregexp.cc. is this a regression from 2.4 though? |