make hooks async
Opened this issue · 0 comments
shubhodeep9 commented
Currently execution of triggers/hooks is synchronous. Need to add support for async hooks.
Proposal
Schema.pre('save', (saveObj, next) => {
// do something with saveObj
next()
// or for error
next(new Error('break execution flow'))
})