shubhodeep9/localstorm

make hooks async

Opened this issue · 0 comments

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'))
})