Skip to content

Fix hooks#112

Open
simon-abbott wants to merge 3 commits intoalonronin:masterfrom
simon-abbott:fix-hooks
Open

Fix hooks#112
simon-abbott wants to merge 3 commits intoalonronin:masterfrom
simon-abbott:fix-hooks

Conversation

@simon-abbott
Copy link

This makes hooks run when executing query ops, which is needed for testing timestamps: true, as well as other custom hooks. It also makes Model.create() execute the "save" hooks, just like mongoose itself does.

This fixes #111.

Mongoose docs state that calling 'create' runs the 'save' hooks. Also
internally both 'save' and '$save' are the same function, and explicitly
set the `op` to 'save' for running hooks. This mirrors that behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Query.exec doesn't run hooks

1 participant