(document, options)
| 3684 | } |
| 3685 | |
| 3686 | async function handleSuccessfulWrite(document, options) { |
| 3687 | const wasNew = document.$isNew; |
| 3688 | if (wasNew) { |
| 3689 | _setIsNew(document, false); |
| 3690 | } |
| 3691 | |
| 3692 | document.$__reset(); |
| 3693 | // version key gets initialized to 0 when inserting a new document so avoid incrementing version key here |
| 3694 | if (!wasNew) { |
| 3695 | document._applyVersionIncrement(); |
| 3696 | } |
| 3697 | const postFilter = buildMiddlewareFilter(options, 'post'); |
| 3698 | return document.schema.s.hooks.execPost('save', document, [document], { filter: postFilter }); |
| 3699 | } |
| 3700 | |
| 3701 | /** |
| 3702 | * Apply defaults to the given document or POJO. |
no test coverage detected