Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-2316

Ignore $regex when parsing Relaxed Extended JSON

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Spec Comp
    • None

      Currently, it's not possible to parse relaxed JSON that contains a $regex.

      That exception originates from _bson_json_read_start_map()

      Also discussed in the Extended JSON spec:

      If you're using $regex as a query operator, the "Parsers" section above says:

      A parser that accepts Legacy Extended JSON MUST be configurable such that a JSON text of a MongoDB query filter containing the regex query operator can be parsed.

      And then it proceeds to give two examples. The first example resembles what you're trying to do here, where the $regex value is the extended JSON representation of a regex object (using the $regularExpression key). I'm not sure why that's prohibited in libbson, but it may be worth asking the C team about.

       

      The need popped when working on a common format to modelise aggregation pipelines in Yaml : https://github.com/mongodb/mongo-php-builder/pull/6#discussion_r1366187184

            Assignee:
            Unassigned Unassigned
            Reporter:
            jerome.tamarelle@mongodb.com Jérôme Tamarelle
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: