Update operators

The following is a list of all update operators that MongoDB supports:

Name

Description

$inc

This increments the value of the field by the specified amount.

$mul

This multiplies the value of the field by the specified amount.

$rename

This renames a field.

$setOnInsert

This sets the value of a field if an update results in an insert of a document. It has no effect on update operations and modifying existing documents.

$set

This sets the value of a field in a document.

$unset

This removes the specified field from a document.

$min

This only updates the field if the specified value is less than the existing field value.

$max

This only updates the field if the specified value is greater than the existing field value.

$currentDate

This sets the value of a field to the current date, either as a date or as a timestamp.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset