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: toJSON with undefined path, add unit test #11922

Merged
merged 1 commit into from
Jun 10, 2022

Conversation

kerryChen95
Copy link

Summary

For doc = model.findById(id, projection), doc may not contain some paths because of projection.

doc.toJSON() should not contain those paths even work with transform.

Examples

See unit test in the changes.

@Uzlopak
Copy link
Collaborator

Uzlopak commented Jun 10, 2022

Please run one time npm run lint -- --fix to solve the linting issues and commit it. Thx

AbdelrahmanHafez added a commit that referenced this pull request Jun 10, 2022
@AbdelrahmanHafez AbdelrahmanHafez added this to the 6.3.7 milestone Jun 10, 2022
@AbdelrahmanHafez AbdelrahmanHafez added the confirmed-bug We've confirmed this is a bug in Mongoose and will fix it. label Jun 10, 2022
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.

Welcome @kerryChen95

LGTM, thanks. 👍

@AbdelrahmanHafez AbdelrahmanHafez merged commit 48f0dc7 into Automattic:master Jun 10, 2022
AbdelrahmanHafez added a commit that referenced this pull request Jun 10, 2022
AbdelrahmanHafez added a commit that referenced this pull request Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug We've confirmed this is a bug in Mongoose and will fix it.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants