json-api-example icon indicating copy to clipboard operation
json-api-example copied to clipboard

How to implement `afterSave` hook?

Open jacobq opened this issue 5 years ago • 0 comments

I would like to call some Mongoose Model instance methods after POST/PATCH request succeeds. Right now the only way I see to do this is to put in some kind of hack in beforeSave that schedules a callback later and queries the database using a unique attr, which is obviously not elegant at all. What built-in hooks are there that might be better suited for this?

jacobq avatar May 21 '20 02:05 jacobq