...

/

Update Documents - Part 3

Update Documents - Part 3

Learn and practice the addToSet, [], and each when updating documents.

$addToSet operator

The $addToSet operator is similar to the $push operator, except it only adds the value if it doesn’t already exist.

$ operator

The $ operator is used to update the value of the first element of an array field returned from the filter query.

Below is an example of updating the first value of tags from new to old ...

Access this course and 1400+ top-rated courses and projects.