Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Scope
Fixes #18802.
In some cases using aliases in nested fields will return
null
, even if data is available. Problem is that inside the recursive functionparseFields
thealias
field on the query is overwritten.Take the following example:
Given a schema with this nested collections:
Complete example schema
When we run the following example code, we will end up with
firstLevelB = null
, which is incorrect!It should return something like
firstLevelB = { id: 1 }
.If we move the
firstLevelB
in the query above thefirstLevelA
, it will actually return the correct value. This is caused by the bug this PR tries to tackle.What's changed:
alias
instead ofquery.alias
Potential Risks / Drawbacks
convertWildcards
function, so the changes are untested if those aren't tested in the blackbox testingReview Notes / Questions