Categories

1 Answer

Oct 12, 2019

If upsert is true and no document matches the query criteria, update() inserts a single document. The update creates the new document with either:

  • The fields and values of the update parameter if the update parameter is a replacement document (i.e., contains only field and value pairs). If neither the query nor the update document specifies an _id field, MongoDB adds the _id field with an ObjectId value.
  • The fields and values of both the query and update parameters if the update parameter contains update operator expressions (such as $inc$set$min$max). The update creates a base document from the equality clauses in the parameter, and then applies the update expressions from the updateparameter. Comparison operations from the query will not be included in the new document.

Also if we want to update multiple documents we can pass multi: true as another option.

Click here to read more about Loan/Mortgage
Click here to read more about Insurance

Related questions

Madanswer
Oct 12, 2019 in Big Data | Hadoop
Oct 12, 2019 in Big Data | Hadoop
Oct 12, 2019 in Big Data | Hadoop
...