Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-57079

Regex with "u" option fails on 5.0.0-alpha0

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • ALL
    • v5.0
    • Hide
      • Connect to a RS running version of MongoDB mentioned above using PyMongo 3.11.4
                from pymongo import MongoClient
                client = MongoClient(directConnection=False)
        
      • Insert the following document:
                client.db.test.insert_one({"x": "hello_test"})
        
      • Run the following find operation:
                import re
                client.db.test.find({"x": re.compile("^hello.*")}))), 4)
        
      Show
      Connect to a RS running version of MongoDB mentioned above using PyMongo 3.11.4 from pymongo import MongoClient client = MongoClient(directConnection= False ) Insert the following document: client.db.test.insert_one({ "x" : "hello_test" }) Run the following find operation: import re client.db.test.find({ "x" : re. compile ( "^hello.*" )}))), 4)
    • Query Execution 2021-06-14, Query Execution 2021-06-28, Query Execution 2021-07-12

      This regression will break all users of PyMongo who are using Python 3 as Python 3 uses the u option by default.

      This regression was discovered when a PyMongo test started failing with the error:

      pymongo.errors.OperationFailure:  invalid flag in regex options: u, full error: {'ok': 0.0, 'errmsg': ' invalid flag in regex options: u', 'code': 51108, 'codeName': 'Location51108', '$clusterTime': {'clusterTime': Timestamp(1621462192, 5), 'signature': {'hash': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'keyId': 0}}, 'operationTime': Timestamp(1621462192, 5)}
      

      Server version:

      db version v5.0.0-alpha0-475-g96d00d9
      Build Info: {
          "version": "5.0.0-alpha0-475-g96d00d9",
          "gitVersion": "96d00d92d71ed9ddc0ac4eb3f60b0b27cb9dcb34",
          "modules": [
              "enterprise"
          ],
          "allocator": "system",
          "environment": {
              "distarch": "x86_64",
              "target_arch": "x86_64"
          }
      }
      

      While the $regex operator documentation does not list u as a supported option, this was working until now.

            Assignee:
            mickey.winters@mongodb.com Mickey Winters
            Reporter:
            prashant.mital Prashant Mital (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved: