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

PyMongo can error when retrieving regular expressions not supported by python

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 2.7
    • None
    • None
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: