Java Driver doesn't handle regex pattern flags like CASE_INSENSITIVE

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Cannot Reproduce
    • Priority: Major - P3
    • None
    • Affects Version/s: 3.8.2, 3.12.0, 3.12.3
    • Component/s: Query Operations
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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);
      FindIterable<MongoEvent> me = collection.find(Filters.regex("name", p));

      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.

              Assignee:
              Ross Lawley
              Reporter:
              Tad Yeager
              None
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: