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

Better support for the setOnInsert update #251

Closed
jakobkmar opened this issue Dec 18, 2020 · 1 comment
Closed

Better support for the setOnInsert update #251

jakobkmar opened this issue Dec 18, 2020 · 1 comment

Comments

@jakobkmar
Copy link
Contributor

jakobkmar commented Dec 18, 2020

It would be great if we could pass objects as a parameter to the setOnInsert function.

Example (UserData is the document type of the collection):

db.userData.findOneAndUpdate(
    UserData::username eq username,
    setOnInsert(UserData()), // <- suggestion
    findOneAndUpdateUpsert()
)
@zigzago
Copy link
Member

zigzago commented Jan 30, 2021

setValueOnInsert method added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants