MongoDB upsert option is used with update method which creates a new document if the query does not retrieve any documents satisfying the criteria. The default value for this option is false. The upsert option does an insert based on the field and value pairs specified in the update parameter …
↧