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: avoid applying map property getters when saving #13704

Merged
merged 3 commits into from Aug 8, 2023

Conversation

vkarpov15
Copy link
Collaborator

Fix #13657

Summary

Right now, save() will actually apply getters on map paths when updating an existing doc. That's why the test case from #13657 shows maps of uuids getting saved as strings. This PR fixes that by making it so that getValue(), Mongoose's internal way to "get dotted path without Mongoose internals", always passes getters: false to map.get().

Examples

lib/utils.js Outdated Show resolved Hide resolved
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.

One minor suggestion, otherwise LGTM. Thanks 👍

lib/utils.js Outdated Show resolved Hide resolved
Copy link
Collaborator

@Uzlopak Uzlopak 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: Uzlopak <aras.abbasi@googlemail.com>
@vkarpov15 vkarpov15 added this to the 7.4.3 milestone Aug 8, 2023
Co-authored-by: Hafez <a.hafez852@gmail.com>
@vkarpov15 vkarpov15 merged commit 2b143d3 into master Aug 8, 2023
34 checks passed
@vkarpov15 vkarpov15 deleted the vkarpov15/gh-13657 branch August 8, 2023 22:19
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.

Map schema type converts UUID into plain string
4 participants