PyMongo can error when retrieving regular expressions not supported by python

XMLWordPrintableJSON

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

      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:
              A. Jesse Jiryu Davis
              Reporter:
              A. Jesse Jiryu Davis
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: