fix: added fix to populate a nested document field inside an array parent when using path string #14443
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.
Fixes #14435
Summary
Added the fix to handle population of fields inside a nested document schema, when the schema of the document is
'nested'
. In some cases, as in the issue attached, where the nested document was inside a parent which is an array, the schema of the field might turn out to be'nested'
in thedocument.get()
function and thus the population was failing and throwing an error, even though intuitively the path made sense. Now, since'nested'
is a string, therefore it won't have the.applyGetters()
function which is present in other schemas, and thus it threw error. Therefore excluded the'nested'
schema from calling that function and preventing failing of the population logic. The result populated data is still correct as by the time this function is called, the population of data for a nested document is already doneExamples
Have added subsequent tests.