Skip to content
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

Merged
merged 2 commits into from
Oct 31, 2024

Conversation

jmikola
Copy link
Member

@jmikola jmikola commented Oct 29, 2024

https://jira.mongodb.org/browse/DRIVERS-3013

Also adds some clarification for $$matchAsDocument and $$matchAsRoot

Please complete the following before merging:

  • Update changelog.

Also adds some clarification for $$matchAsDocument and $$matchAsRoot
@jmikola jmikola requested a review from stIncMale October 29, 2024 13:43

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.
Copy link
Member Author

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.

@jmikola jmikola marked this pull request as ready for review October 29, 2024 14:32
@jmikola jmikola requested a review from a team as a code owner October 29, 2024 14:32
@jmikola jmikola requested review from alcaeus and removed request for a team October 29, 2024 14:32

```yaml
expected: [ { x: 1 }, { x: 2 } ]
actual: [ { x: 1, y: 1 }, { x: 2, y: 2 } ]
```

##### Examples of Root-level Documents
Copy link
Member Author

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.

@jmikola
Copy link
Member Author

jmikola commented Oct 31, 2024

@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 jmikola merged commit 9ad41a1 into mongodb:master Oct 31, 2024
4 checks passed
@stIncMale
Copy link
Member

@jmikola I finally got to this PR. Thank you for doing the analysis and reflecting it in this PR!

@jmikola jmikola deleted the drivers-3013 branch November 22, 2024 02:59
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