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

Add support for findOneAndReplace? #104

Open
jrista opened this issue Jul 10, 2018 · 2 comments
Open

Add support for findOneAndReplace? #104

jrista opened this issue Jul 10, 2018 · 2 comments

Comments

@jrista
Copy link

jrista commented Jul 10, 2018

I have been using Mongorito for some time now, and I really like it over some of the alternative node.js driver options out there. Mongorito uses mquery underneath the surface, which is great, since all of the mquery functionality is exposed.

I have on a growing number of occasions now run into a need for findOneAndReplace. This was added in MongoDB 3.2, and is one of the most useful update methods for me these days. I am not sure if there is a reason this operator has not been added, however i would love to see it added. I have multiple uses for it at the current time.

@aheckmann
Copy link
Collaborator

Sounds good. Please submit a PR.

@Fonger
Copy link
Contributor

Fonger commented Jul 31, 2018

You can use findOneAndUpdate with .setOptions({replace: true}) to achieve your goal. The replace option is only valid in mquery and support old MongoDB. It works as polyfill and maybe need to be updated to use latest driver version to enhance performance.

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