public function addToSet($valueOrExpression) : self
    {
        if ($valueOrExpression instanceof Expr) {
            $valueOrExpression = $valueOrExpression->getQuery();
        }

        $this->requiresCurrentField();
        $this->newObj['$addToSet'][$this->currentField] = $valueOrExpression;
        return $this;
    }
public function addToSet($valueOrExpression) : self
    {
        if ($valueOrExpression instanceof Expr) {
            $valueOrExpression = $valueOrExpression->getQuery();
        }

        $this->requiresCurrentField();
        $this->newObj['$addToSet'][$this->currentField] = $valueOrExpression;
        return $this;
    }
public function addToSet ( $ valueOrExpression ) : self { if ( $ valueOrExpression instanceof Expr ) { $ valueOrExpression = $ valueOrExpression -> getQuery ( ) ; } $ this -> requiresCurrentField ( ) ; $ this -> newObj [ '$addToSet' ] [ $ this -> currentField ] = $ valueOrExpression ; return $ this ; }
Append one or more values to the current array field only if they do not
already exist in the array.

If the field does not exist, it will be set to an array containing the
unique value(s) in the argument. If the field is not an array, the query
will yield an error.

Multiple values may be specified by provided an Expr object and using
{@link Expr::each()}.

@see Builder::addToSet()
@see http://docs.mongodb.org/manual/reference/operator/addToSet/
@see http://docs.mongodb.org/manual/reference/operator/each/

@param mixed|Expr $valueOrExpression
Append one or more values to the current array field only if they do not already exist in the array .