Automattic / mongoose

MongoDB object modeling designed to work in an asynchronous environment.
https://mongoosejs.com
MIT License
26.85k stars 3.82k forks source link

Feature: Add hooks all mongodb related operations #11587

Open GO-DIE opened 2 years ago

GO-DIE commented 2 years ago

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

What is the current behavior? Currently, middleware coverage is incomplete, such as some operations like 'bulkSave', 'bulkWrite', 'exists', 'distinct', 'watch' that have no middleware to trigger. I can't do it when I need to intercept and process all mongodb related operations.

Or another way of thinking, because all operations are related to Document, Model, Query and Aggregate, can we provide these types of interception for developers to use the unified interception tools.

What is the expected behavior? All mongodb related operations can be intercepted and processed.

Uzlopak commented 2 years ago

What is the "unified interception Tools"? Do you mean the hook system?

The question is if this results in a significant performance hit.