Skip to content

fix: avoid minimizing single nested subdocs if they are required #14151

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 1 commit into from
Dec 5, 2023

Conversation

vkarpov15
Copy link
Collaborator

Fix #14058

Summary

#14058 pointed out an unfortunate issue with the fix for #11247: required subdocuments without defaults end up getting minimized out, which leads to errors on subsequent saves by default unless you use the validateBeforeSave: false option for save(). This behavior is very unintuitive. With this PR, we'll skip minimizing subdocuments that have required set to a truthy value, including functions. So still works as expected if not required.

Examples

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.

2 participants