-
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-3013: List more examples of root-level documents #1694
Conversation
Also adds some clarification for $$matchAsDocument and $$matchAsRoot
|
||
Matching the expected value MUST use the standard rules in [Evaluating Matches](#evaluating-matches), which means that | ||
it may contain special operators. The actual value MUST NOT be considered a root-level document (i.e. extra fields are | ||
not permitted); however, [$$matchAsRoot](#matchasroot) may be used to change that behavior. |
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.
I dug up #1303 (comment) to get context on the relationship between $$matchAsDocument
and $$matchAsRoot
.
Also talked to @kmahar in Slack about this and I agree that there is better terminology than "root-level" to communicate whether extra fields are allowed or not, but we're probably stuck with it given the $$matchAsRoot
operator. If there's ever consensus to change this down the line, I suppose we could introduce an alias and then revise the spec to replace all references to "root-level", but I'm not about to do that here.
|
||
```yaml | ||
expected: [ { x: 1 }, { x: 2 } ] | ||
actual: [ { x: 1, y: 1 }, { x: 2, y: 2 } ] | ||
``` | ||
|
||
##### Examples of Root-level Documents |
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.
@stIncMale: I went through the spec and inferred what root-level contexts I could. Since operations aren't entirely defined there, and PHP is behind on many specs (e.g. CSOT), I have no idea if it's complete; however, it at least adds a point where the full list can be maintained as other contexts are found.
I notably removed the "includes but not limited to" line from the original text and gave this its own section.
@stIncMale: I'm going to merge this, but feel free to submit a follow-up PR if you have additional input that wasn't incorporated. |
@jmikola I finally got to this PR. Thank you for doing the analysis and reflecting it in this PR! |
https://jira.mongodb.org/browse/DRIVERS-3013
Also adds some clarification for $$matchAsDocument and $$matchAsRoot
Please complete the following before merging: