mongoose-lifecycle
mongoose-lifecycle copied to clipboard
added hooks for Schemas
Hi Francois,
For architectural purposes at Kimono Labs, we wanted to be able to add a post "insertAfter" hook on the schema rather than the model, which kept us from repeating code in an application where schemas were utilized in multiple files.
What are your thoughts? I temporarily created a mongoose-lifecycle2 package but will definitely take it down if this PR is integrated. Tests and documentation has yet to be made.
Cheers, Shri
I agree that it would be useful to have these lifecycle events at the schema level as well as model.