You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Also worth noting: you can omit _id in the replacement. So if _id is in replacement, it should be exactly equal to the _id in the db. But if omitted, findOneAndReplace() will use the existing document's _id.
Replaces a single document based on the specified filter and sort. Returns a document in response.
{ "findOneAndReplace" : { "filter" : {filter clause}, "sort" : {sort clause}, "replacement" : {document to replace}, "options" : {"returnDocument" : "before/after"} } }
If upsert is
true
, insert the replacement document as new record.if returnDocument is
before
return existing document, else return replaced document.Validation: If the replacement document "_id" field is different from document read from the DB, throw error.
The text was updated successfully, but these errors were encountered: