Skip to content

Remove $setOnInsert from findOneAndUpdate#100

Open
alansikora wants to merge 5 commits into
scottwrobinson:masterfrom
alansikora:master
Open

Remove $setOnInsert from findOneAndUpdate#100
alansikora wants to merge 5 commits into
scottwrobinson:masterfrom
alansikora:master

Conversation

@alansikora

Copy link
Copy Markdown

I had to remove $setOnInsert from MongoClient because that would cause updates to never work.

As stated here: https://docs.mongodb.com/manual/reference/operator/update/setOnInsert/

If an update operation with upsert: true results in an insert of a document, then $setOnInsert assigns the specified values to the fields in the document. If the update operation does not result in an insert, $setOnInsert does nothing.

Am I missing something?

@alansikora alansikora changed the title Remove $setOnInsert Remove $setOnInsert from findOneAndUpdate Feb 20, 2017
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.

2 participants