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(mongoose): allow drivers to set global plugins #14682

Merged
merged 1 commit into from
Jun 24, 2024

Conversation

vkarpov15
Copy link
Collaborator

Summary

One thing that's unfortunately missing from the driver API is the ability to set global plugins. Drivers can always do mongoose.plugin(myPlugin), but the problem is that assumes you only have one Mongoose instance. If a user were to do const mongoose = new Mongoose(); mongoose.setDriver(myDriver);, then there's no way for that driver to apply plugins to the new Mongoose instance.

With this PR, drivers can export a plugins array that setDriver() will look for, and apply plugins to the Mongoose instance.

Examples

@hasezoey hasezoey added this to the 8.5 milestone Jun 24, 2024
@vkarpov15 vkarpov15 merged commit 87c57e6 into 8.5 Jun 24, 2024
45 of 46 checks passed
@hasezoey hasezoey deleted the vkarpov15/driver-plugins branch June 25, 2024 08:40
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.

2 participants