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

Change streams: return mongoose Document if fullDocument is present in the change document #11936

Closed
2 tasks done
juona opened this issue Jun 14, 2022 · 1 comment
Closed
2 tasks done
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature new feature This change adds new functionality, like a new method or class
Milestone

Comments

@juona
Copy link

juona commented Jun 14, 2022

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

MongoDB change events may contain the whole document that was modified under the key fullDocument. Would it make sense to have mongoose automatically wrap this in an appropriate mongoose Document class?

Motivation

Given that I already use mongoose Documents most of the time, it might make sense to have them here. This would enable me to use instance methods, getters, setters, virtual fields, etc.

Example

No response

@juona juona added enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature new feature This change adds new functionality, like a new method or class labels Jun 14, 2022
@Uzlopak
Copy link
Collaborator

Uzlopak commented Jun 14, 2022

It should atleast be activated under an options flag, because hydrating Documents is a performance eater.

@vkarpov15 vkarpov15 added this to the 6.5 milestone Jun 17, 2022
vkarpov15 added a commit that referenced this issue Jul 19, 2022
vkarpov15 added a commit that referenced this issue Jul 26, 2022
feat(model): add `hydrate` option to `Model.watch()` to automatically hydrate `fullDocument`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature new feature This change adds new functionality, like a new method or class
Projects
None yet
Development

No branches or pull requests

3 participants