[SERVER-4805] query { $not : { $regex : /x/ } } doesn't work Created: 28/Jan/12 Updated: 06/Dec/22 Resolved: 12/Jan/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 2.0.2, 2.5.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | aochen | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Duplicate | Votes: | 1 |
| Labels: | bson, commands, query, query_triage | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows server 2008 r2 sp1 |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Query
|
||||||||
| Operating System: | Windows | ||||||||
| Participants: | |||||||||
| Description |
|
This page documents that $not with $regex is disallowed, but this behavior seems counterintuitive from an end-user perspective and perhaps could be reconsidered. Setup a simple repro:
Using $not with a raw BSON regex works as expected:
But using $not with $regex returns an error:
Original description: I tried to do a "Not like" query with following codes : However, I tried to build with object builder : Meanwhile, the '.jsonString()' of these two objects are the same. |
| Comments |
| Comment by J Rassi [ 12/Jan/16 ] |
|
Closing as a duplicate of |