-
Notifications
You must be signed in to change notification settings - Fork 244
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
DRIVERS-2573: Reference test for $$matchAsDocument and $$matchAsRoot #1706
Conversation
|
||
# Note: $$lte is not technically in the 1.8 schema but was introduced at the same time. | ||
# Note: $$lte was introduced alongside schema changes for CSOT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed this file for consistency, as I didn't like the matches-<name>-operator.yml
convention. Our other test files are generally prefixed with the logical type of the thing being tested, so I went with operator-<name>
.
"1.8" was also never the correct schema version for CSOT.
databaseName: *database0Name | ||
documents: | ||
- { _id: 1, json: '{ "x": 1, "y": 2 }' } | ||
- { _id: 2, json: '{ "x" }' } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add an error case where json
is a json array.
- { _id: 2, json: '{ "x" }' } | |
- { _id: 2, json: '{ "x" }' } | |
- { _id: 3, json: '[{"x":1}]' } |
It seems to be in your implementation: https://github.com/mongodb/mongo-php-library/pull/1508/files#diff-5911ac585872dc4a55ff2fe77af552d46e160b4d5636699c9cf2c1211217e25eR278
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some additional valid-fail tests with unexpected JSON strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests pass locally in Python, running a patch here: mongodb/mongo-python-driver#1988
This uncovered a bunch of issues with Python's implementation of $$matchAsDocument and $$matchAsRoot. Nice work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Also revises the comment, which previously referred to the incorrect schema version for CSOT.
@ShaneHarvey: I made some test revisions based on @GromNaN's feedback. Also removed a useless test for |
https://jira.mongodb.org/browse/DRIVERS-2573
Please complete the following before merging:
Note: I implemented
$$matchAsDocument
and$$matchAsRoot
in PHPLIB in order to POC this, so I'd appreciate it if another language driver could also test this.