(document, options)
| 3751 | } |
| 3752 | |
| 3753 | async function handleSuccessfulWrite(document, options) { |
| 3754 | const wasNew = document.$isNew; |
| 3755 | if (wasNew) { |
| 3756 | _setIsNew(document, false); |
| 3757 | } |
| 3758 | |
| 3759 | document.$__reset(); |
| 3760 | // version key gets initialized to 0 when inserting a new document so avoid incrementing version key here |
| 3761 | if (!wasNew) { |
| 3762 | document._applyVersionIncrement(); |
| 3763 | } |
| 3764 | const postFilter = buildMiddlewareFilter(options, 'post'); |
| 3765 | return document.schema.s.hooks.execPost('save', document, [document], { filter: postFilter }); |
| 3766 | } |
| 3767 | |
| 3768 | /** |
| 3769 | * Apply defaults to the given document or POJO. |
no test coverage detected