Skip to content

Commit

Permalink
fix(model): skip applying init hook if called with `schema.pre(..., {…
Browse files Browse the repository at this point in the history
… document: false })`

Fix #9316
  • Loading branch information
vkarpov15 committed Aug 25, 2020
1 parent d56059a commit 0b8c6a1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/helpers/model/applyHooks.js
Expand Up @@ -75,7 +75,7 @@ function applyHooks(model, schema, options) {
if (hook.name === 'updateOne' || hook.name === 'deleteOne') {
return !!hook['document'];
}
if (hook.name === 'remove') {
if (hook.name === 'remove' || hook.name === 'init') {
return hook['document'] == null || !!hook['document'];
}
return true;
Expand Down

0 comments on commit 0b8c6a1

Please sign in to comment.