[SERVER-54588] Query on system.profile() failing when certain regex is recorded Created: 17/Feb/21 Updated: 06/Dec/22 Resolved: 04/Mar/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 4.4.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Adamo Tonete (Inactive) | Assignee: | Backlog - Query Execution |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||
| Assigned Teams: |
Query Execution
|
||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||
| Steps To Reproduce: |
1. Using Ruby but it also works on C# and likely other drivers. 2. File called repro.rb contains the following code:
3. File called repro2.rb contains the following code:
— Steps to reproduce — #lauching mongodb* mlaunch --single #setting profiler to 2 #executing first repro, please note we are specifyng /im here #attempt to read the system.profile() Expected error: Error: Error: SyntaxError: invalid regular expression flag s #dumping the system.profile collection: #cleaning the system profile collection for a new test without /m* #executing the second test without specifying /m* #attempt to read the system.profile() expected error: Error: invalid regexp group #dumping the system.profile collection: |
||||||||||||||||||
| Sprint: | Query Execution 2021-03-22 | ||||||||||||||||||
| Participants: | |||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||
| Description |
|
When running find command on system.profile if the recorded command contains specific regex the shell is returning an error.
Some error messages are: Repro attached |
| Comments |
| Comment by Bernard Gorman [ 04/Mar/21 ] |
|
I don't believe the server is doing anything wrong here, since it's correctly interpreting a BSONRegex argument that is sent to it - the only "problem" is that the BSONRegex encodes a native PCRE expression. Our docs page specifically mentions the (?-i) pattern as one which Javascript does not support, and which must therefore be supplied as a string using the $regex form, but the entire docs page is written from the perspective of a Javascript client. In order for the server to address this, we would have to manually validate that an expression which PCRE successfully compiles nonetheless does not adhere to our documented rules about what can be expressed in /regex/ format and what must be expressed in $regex:"" format on the driver's side. I don't think that's sensible, given that those rules are not really restrictions, but rather explain how a Javascript client which cannot understand PCRE /patterns/ can nonetheless send PCRE patterns to the server. Looks like the Drivers team already handled this issue long ago ( |