Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hooks for doc.updateOne() #7133

Closed
YuriGor opened this issue Oct 14, 2018 · 4 comments
Closed

Hooks for doc.updateOne() #7133

YuriGor opened this issue Oct 14, 2018 · 4 comments
Milestone

Comments

@YuriGor
Copy link

YuriGor commented Oct 14, 2018

Regex hook name and options object parameters of pre look like not working.

(K)Ubuntu 18.04
Node v10.7.0
mongodb 3.6.3
mongoose v5.3.3

https://gist.github.com/YuriGor/cc8114a0d0b1ad151eaf58baab24aa3a

@YuriGor
Copy link
Author

YuriGor commented Oct 14, 2018

Shame on me, it was not a good idea to use arrow functions as pre callbacks.

@YuriGor YuriGor closed this as completed Oct 14, 2018
@YuriGor YuriGor changed the title pre update(One) - no way to change anything? pre update(One) - regex hook name and options object parameter look like not working Oct 14, 2018
@YuriGor
Copy link
Author

YuriGor commented Oct 14, 2018

I updated linked gist to not use arrow function.

@YuriGor YuriGor reopened this Oct 14, 2018
@YuriGor
Copy link
Author

YuriGor commented Oct 14, 2018

Okay, regex works on latest version of mongoose,
but options.document/query parameter looks like ignored.
no matter how do I set this flags, hook always runs.

@YuriGor YuriGor changed the title pre update(One) - regex hook name and options object parameter look like not working pre updateOne - options.document/query parameter looks like ignored Oct 14, 2018
@vkarpov15
Copy link
Collaborator

Right now we don't support hooking doc.updateOne(), we only support hooking the functions listed on the middleware docs. In particular, the document/query parameter only affects remove(). We'll add hooks for doc.updateOne() in a future release.

@vkarpov15 vkarpov15 added this to the 5.4 milestone Oct 15, 2018
@vkarpov15 vkarpov15 changed the title pre updateOne - options.document/query parameter looks like ignored Hooks for doc.updateOne() Oct 15, 2018
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

No branches or pull requests

3 participants