Skip to content

Added support for 'findOneAndUpdate' and 'update' with upsert #9

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

Closed

Conversation

linusbrolin
Copy link

As per request, made a PR against the develop branch instead of master.

iagowp and others added 4 commits June 15, 2016 11:01
Helps people who are newer to use the project
ramiel#3
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.
@linusbrolin linusbrolin changed the title Query middleware support Added support for 'findOneAndUpdate' and 'update' with upsert Aug 26, 2016
…al update query

This should prevent any possible error due to undefined _id in the
_update object
@linusbrolin
Copy link
Author

Alright, so I think I've solved everything now.
I changed the findOne query so it uses the same conditions as the original query.
This should prevent any bad scenario where the _id field is not included.

@ramiel
Copy link
Owner

ramiel commented Aug 26, 2016

Ok, perfect. I added some tests and done a little roadmap to have this properly working.
So I close this PR and you can refer on #10. We still need to rebase on latest develop.
Nice, nice job, thank you!
Ah, you're free to help me on finalize this of course!

@ramiel ramiel closed this Aug 26, 2016
@linusbrolin
Copy link
Author

Cool, thanks. :)

@blocks-master
Copy link

any update on this ? Still not working

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.

4 participants