Skip to content

CDRIVER-3773 Support regular expressions with no options #751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2021
Merged

CDRIVER-3773 Support regular expressions with no options #751

merged 1 commit into from
Mar 10, 2021

Conversation

benjirewis
Copy link
Contributor

CDRIVER-3773

python-bsonjs, which relies on libbson, requested the ability to load regexes without the "options" field through JSON into BSON. I see no language in the extended JSON spec forbidding this behavior, and it's unlikely an existing user would actively expect a "missing options" error, so it seems ok to add.

Removes the "missing options" errors in _bson_json_read_append_regex and adds two new tests to verify correct parsing and absence of error for legacy and canonical regexes without options.

@benjirewis benjirewis requested a review from bazile-clyde March 9, 2021 21:07
Copy link
Contributor

@bazile-clyde bazile-clyde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@benjirewis benjirewis merged commit 2e685d1 into mongodb:master Mar 10, 2021
@benjirewis benjirewis deleted the allowNoOptionsRegex.3773 branch March 10, 2021 18:10
@alcaeus
Copy link
Member

alcaeus commented Mar 11, 2021

@benjirewis this change breaks the bson-corpus test suite in PHP. There is a test that expects a parse error when presented a regular expression without options: https://github.com/mongodb/specifications/blob/master/source/bson-corpus/tests/top.json#L74..L77.

I'll skip the test in PHP, but wanted to give you a heads up that this is covered by the corpus.

@benjirewis
Copy link
Contributor Author

Apologies for overlooking that test. Looking into how important the change is for python-bsonjs. I'll remove this change no matter what since it's spec-test breaking. If we still want to make the change, I'll do it through a drivers ticket with an actual spec change instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants