Skip to content

fix(document): handle default values for discriminator key with embedded discriminators #13891

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

Merged
merged 2 commits into from
Sep 25, 2023

Conversation

vkarpov15
Copy link
Collaborator

Fix #13835

Summary

Currently, Mongoose doesn't pick up default values for the discriminator key when creating a new subdocument. The default value doesn't get set until after Mongoose decides which constructor to use. So this PR makes Mongoose check for default values on the discriminator key when initializing a subdocument.

Examples

@vkarpov15 vkarpov15 added this to the 7.5.3 milestone Sep 25, 2023
@vkarpov15 vkarpov15 merged commit f4fc8a7 into master Sep 25, 2023
@vkarpov15 vkarpov15 deleted the vkarpov15/gh-13835 branch September 25, 2023 14:56
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.

Nested discriminator schema: property is undefined
2 participants