scottwrobinson / camo

A class-based ES6 ODM for Mongo-like databases.
556 stars 80 forks source link

Remove $setOnInsert from findOneAndUpdate #100

Open alansikora opened 7 years ago

alansikora commented 7 years ago

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?