Reference/Operators/Array Update/$addToSet$addToSetThe `$addToSet` operator adds a value to an array only if the value is not already present in the array.Syntax{ $addToSet: { field: <value> } }ParametersfieldstringrequiredThe field to update.<value>stringrequiredThe value to add to the array if it doesn't already exist.
Reference/Operators/Array Update/$addToSet$addToSetThe `$addToSet` operator adds a value to an array only if the value is not already present in the array.Syntax{ $addToSet: { field: <value> } }ParametersfieldstringrequiredThe field to update.<value>stringrequiredThe value to add to the array if it doesn't already exist.