-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat(model): add Model.applyVirtuals()
to apply virtuals to a POJO
#14905
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly looks good to me, some minor style suggestions, aside from that:
- typescript types for the new
applyVirtuals
are not added yet - there is a distinct lack of documentation in the
applyVirtuals
file
Co-authored-by: hasezoey <hasezoey@gmail.com>
Co-authored-by: hasezoey <hasezoey@gmail.com>
@hasezoey thanks for the feedback. I added docs and addressed issues 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, typescript types for the new applyVirtuals
on Model
are still missing though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
Fix #14818
Summary
Logic largely copied from https://github.com/mongoosejs/mongoose-lean-virtuals/blob/master/index.js to apply a Model's virtuals to a POJO.
Examples