-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Query middleware support #10
base: develop
Are you sure you want to change the base?
Conversation
I found another bug, when using scoped counter (I never tested that before, my bad), where the reference value(s) would be null. |
I'll do, and I will add the related test |
0753518
to
12939b8
Compare
12939b8
to
b50319d
Compare
This will make the sequence plugin work with upsert operations.
Unfortunately it seems there is no way to know in the query if an upsert will result in an insert or update, according to this mongoose issue: Automattic/mongoose#2118 So the only way to know is to make another query to find out.
…al update query This should prevent any possible error due to undefined _id in the _update object
b50319d
to
96d6639
Compare
Adds tests which demonstrate that reference fileds are not upated correctly
Looks like those hooks are complex to manage
any update ? It's still not working for findOneAndUpdate |
@ramiel I have now rebased my branch on the latest code from your master branch, and updated the code accordingly. If you could add the needed tests then I would very much appreciate it, otherwise I'll see if I can find time to do that myself. For now I have added a check for the But I honestly think we should at the very least get support for upserting single documents released now, as it's been 5 years since my original PR! Let me know what you think. |
Update counters on
findOneAndUpdate
andupdate
Based on the work by @linusbrolin.
multi
option (on update)