-
Type: New Feature
-
Resolution: Unresolved
-
Priority: 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
- depends on
-
CDRIVER-4769 Support parsing $regex query operator appearing in Extended JSON
- Backlog
- is depended on by
-
PHPLIB-1271 Test system for operators and stages
- Closed