Skip to content

fix(document): correctly handle modified subpaths when parent path is unset after modifying#16271

Merged
vkarpov15 merged 1 commit into
masterfrom
vkarpov15/gh-16252
May 5, 2026
Merged

fix(document): correctly handle modified subpaths when parent path is unset after modifying#16271
vkarpov15 merged 1 commit into
masterfrom
vkarpov15/gh-16252

Conversation

@vkarpov15
Copy link
Copy Markdown
Collaborator

Fix #16252

Summary

#16252 highlighted that, when building the document delta in $__dirty(), use top != null to check whether we should add the path to the delta, which breaks down if the parent path is unset. For example, if allPaths.has(array[i]) is true but the value of array[i] is undefined (like if unset using delete) Mongoose will keep the subpath in the delta.

Examples

@vkarpov15 vkarpov15 requested review from AbdelrahmanHafez, Copilot and hasezoey and removed request for Copilot May 4, 2026 14:59
Copy link
Copy Markdown
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

@vkarpov15 vkarpov15 added this to the 9.6.2 milestone May 5, 2026
@vkarpov15 vkarpov15 merged commit 2b7bb96 into master May 5, 2026
98 of 100 checks passed
@vkarpov15 vkarpov15 deleted the vkarpov15/gh-16252 branch May 5, 2026 20:58
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.

mongo write Conflict

3 participants