Doctrine\MongoDB\Query\Expr::pull PHP Method

pull() public method

Remove all elements matching the given value or expression from the current array field.
See also: Builder::pull()
See also: http://docs.mongodb.org/manual/reference/operator/pull/
public pull ( mixed | Expr $valueOrExpression )
$valueOrExpression mixed | Expr
    public function pull($valueOrExpression)
    {
        if ($valueOrExpression instanceof Expr) {
            $valueOrExpression = $valueOrExpression->getQuery();
        }
        $this->requiresCurrentField();
        $this->newObj['$pull'][$this->currentField] = $valueOrExpression;
        return $this;
    }

Usage Example

示例#1
0
 /**
  * Remove all elements matching the given value or expression from the
  * current array field.
  *
  * @see Expr::pull()
  * @see http://docs.mongodb.org/manual/reference/operator/pull/
  * @param mixed|Expr $valueOrExpression
  * @return self
  */
 public function pull($valueOrExpression)
 {
     $this->expr->pull($valueOrExpression);
     return $this;
 }