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

Generate Upsert Resolvers #387

Open
dannydi12 opened this issue Oct 7, 2021 · 3 comments
Open

Generate Upsert Resolvers #387

dannydi12 opened this issue Oct 7, 2021 · 3 comments

Comments

@dannydi12
Copy link

I was wondering if I can modify the updateOne or createOne generated resolvers to insert/update depending on whether the document exists.

Usually, I would just create a custom resolver and pass the { upsert: true } option to mongoose. But it would be a lot of work to make a ton of custom resolvers for something that can easily be generated but with a small change.

Please let me know if there is any way to accomplish this! Thanks!

@Resousse
Copy link

As a user, I would appreciate this upsert feature a lot !

I see there is in mongoose already a method findOneAndUpdate that embeds upsert feature, may be implementation wouldn't be too complex, if just creating a new resolver that uses this

@darwinphi
Copy link

Any update on this?

@DrakeAnglin
Copy link

This is much needed!

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

4 participants