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(update): allow setting paths with dots under non-strict paths #13450

Merged
merged 1 commit into from May 30, 2023

Conversation

vkarpov15
Copy link
Collaborator

Fix #13434
Re: #10200

Summary

One of @AbdelrahmanHafez 's early issues #10200 pops up :) we shouldn't apply setDottedPaths() if schema is not strict and we don't have a schematype, because MongoDB supports storing paths with dots now.

Examples

Copy link
Collaborator

@AbdelrahmanHafez AbdelrahmanHafez left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!
One question though. How's this going to affect Mixed paths? Do we still split keys or this change would make it so that paths are now dot-separated?

@vkarpov15
Copy link
Collaborator Author

@AbdelrahmanHafez Schema({ info: Object }) is equivalent to Schema({ info: Mixed }), so the test case covers this. Mongoose would store { 'second.name': 'value' } rather than { second: { name: 'value' } }. However, this PR doesn't change that behavior, that's how Mongoose worked before this change.

@vkarpov15 vkarpov15 added this to the 7.2.2 milestone May 30, 2023
@vkarpov15 vkarpov15 merged commit 15164f2 into master May 30, 2023
34 checks passed
@vkarpov15 vkarpov15 deleted the vkarpov15/gh-13434 branch May 30, 2023 13:45
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.

Model.findOneAndUpdate() is updating nested fields with 'strict:false'
3 participants