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

PyMongo can error when retrieving regular expressions not supported by python

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.7
    • Component/s: None
    • Labels:
      None
    • Backwards Compatibility:
      Major Change

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: