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

feat: add forceRepopulate option for populate() to allow avoiding repopulating already populated docs #15044

Open
wants to merge 1 commit into
base: 8.9
Choose a base branch
from

Conversation

vkarpov15
Copy link
Collaborator

Fix #14979

Summary

It is a little strange that doc.populate('child') will populate 'child' even if 'child' is already populated. This PR adds an option to disable that behavior, either for an individual populate call using doc.populate({ path: 'child', forceRepopulate: false }) or globally with mongoose.set('forceRepopulate', false).

We should consider making forceRepopulate default to false for Mongoose 9.

Examples

@vkarpov15 vkarpov15 added this to the 8.9 milestone Nov 15, 2024
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.

1 participant