Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-500

PyMongo can error when retrieving regular expressions not supported by python

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.7
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Major Change

      Since MongoDB's PCREs have an alternate syntax from Python's regular expressions, and since PyMongo tries to compile every regex-type BSON value it retrieves from MongoDB, PyMongo will throw an error retrieving some regular expressions.

      It would be better to return either a new bson.Regex type that encapsulates the string from MongoDB, or to return a dictionary like

      {"$regex": "...", "$options": "..."}

      .

      In either case, PyMongo shouldn't try to compile every regex-type BSON value as a Python regex.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: