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

fix(model): handle document array paths set to non-array values in Model.castObject() #15124

Merged
merged 2 commits into from
Dec 22, 2024

Conversation

vkarpov15
Copy link
Collaborator

Fix #15075

Summary

#15075 pointed out that Model.castObject() silently ignores document arrays that are set to primitive non-null values. This PR fixes that, including accounting for castNonArrays schema object.

Examples

@vkarpov15 vkarpov15 added this to the 8.9.3 milestone Dec 19, 2024
lib/model.js Outdated Show resolved Hide resolved
Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Co-authored-by: Djamel Benali <[email protected]>
@vkarpov15 vkarpov15 merged commit 682160f into master Dec 22, 2024
72 of 74 checks passed
@vkarpov15 vkarpov15 deleted the vkarpov15/gh-15075-2 branch December 22, 2024 19:29
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.

Mongoose 8.x: Discriminator schema validation breaks in static validation
3 participants