-
Notifications
You must be signed in to change notification settings - Fork 96
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
Support document middleware #395
Comments
This should work already as long as you set the |
@daffl I've read that too somewhere, but it doesn't! I've tried every possible way/setting/option. |
Ideally we'd need an example of what isn't working as expected then. |
Yep, I totally get that. Will see if I get time to throw together a small repro repo. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature request
Support document middleware
Background
AFAIK, document middleware, such as mongoose pre-save hooks, are not supported. I'm assuming that this is because feathers-mongoose uses queries such as
findOneAndUpdate()
rather than loading the document and then saving it (see https://mongoosejs.com/docs/middleware.html#notes).As suggested in other issues, it's possible, and often recommended, to utilise Feathers service hooks instead. However, there are use cases when that option is not very fitting. An example is when you are re-using a single schema in several other schemas. Perhaps even nested on different levels in different models.
In such a use case, using service hooks would be very messy compared to a single, all-encompassing Mongoose pre validate/save/remove hook.
The text was updated successfully, but these errors were encountered: