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

Add model, deleteModel events to connection #9983

Closed
vkarpov15 opened this issue Mar 1, 2021 · 0 comments
Closed

Add model, deleteModel events to connection #9983

vkarpov15 opened this issue Mar 1, 2021 · 0 comments
Labels
new feature This change adds new functionality, like a new method or class
Milestone

Comments

@vkarpov15
Copy link
Collaborator

Do you want to request a feature or report a bug?

Feature

What is the current behavior?

Right now there is no way for a plugin to be notified if a model is deleted. The 'init' event on schemas can tell you when a model is init-ed, but that is counterintuitive.

What is the expected behavior?

conn.on('model', model => console.log('Created model ' + model.modelName));
conn.on('deleteModel', model => console.log('Deleted model ' + model.modelName));

What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.

Mongoose 5.11.x. Node.js and MongoDB versions don't matter for this issue.

@vkarpov15 vkarpov15 added the new feature This change adds new functionality, like a new method or class label Mar 1, 2021
@vkarpov15 vkarpov15 added this to the 5.12 milestone Mar 1, 2021
vkarpov15 added a commit that referenced this issue Mar 4, 2021
This was referenced Mar 11, 2021
This was referenced Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature This change adds new functionality, like a new method or class
Projects
None yet
Development

No branches or pull requests

1 participant