[JAVA-3708] Java Driver doesn't handle regex pattern flags like CASE_INSENSITIVE Created: 22/Apr/20 Updated: 22/Apr/20 Resolved: 22/Apr/20 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Query Operations |
| Affects Version/s: | 3.8.2, 3.12.0, 3.12.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Tad Yeager | Assignee: | Ross Lawley |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
com.mongodb.client.model.Filters.regex(String fieldName, Pattern pattern) doesn't respect options like CASE_INSENSITIVE. Pattern p = Pattern.compile("(.)" + name.toLowerCase() + "(.)", Pattern.CASE_INSENSITIVE); if translated to this command: '{ "find" : "test.test_account", "filter" : { "name" : { "$regularExpression" : { "pattern" : "(.*)s1lvcvky(.*)", "options" : "" }} } }' So, upgrading my driver wrapper broke everything because compiled Pattern regular expressions are no longer supported properly. Driver wrapper doesn't support regex options, ie regex(String fieldName, String pattern, String options). Only related bug I found had to do with Pattern codec tests. |
| Comments |
| Comment by Ross Lawley [ 22/Apr/20 ] | |||||||||||||||||||||
|
Glad to hear you figured it out.
Ross | |||||||||||||||||||||
| Comment by Tad Yeager [ 22/Apr/20 ] | |||||||||||||||||||||
|
My bad. It's the driver wrapper/serialization layer, MongoJack. Iit's not serializing the Filter correctly. Sorry about that, please close. Thanks. | |||||||||||||||||||||
| Comment by Jeffrey Yemin [ 22/Apr/20 ] | |||||||||||||||||||||
|
I attempted to reproduce this with the 3.12 driver, and wasn't successful. Here's the complete test program
It outputs:
It's not clear to me what's different in your scenario. Can you provide a complete program that reproduces the issue? | |||||||||||||||||||||
| Comment by Jeffrey Yemin [ 22/Apr/20 ] | |||||||||||||||||||||
From which version of the driver did you upgrade? Also, I'm not sure what you mean by "driver wrapper". I'm assuming you just mean the driver but let me know if I'm mistaken. | |||||||||||||||||||||
| Comment by Tad Yeager [ 22/Apr/20 ] | |||||||||||||||||||||
|
Maybe? | |||||||||||||||||||||
| Comment by Tad Yeager [ 22/Apr/20 ] | |||||||||||||||||||||
|
related? |