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

elemMatch() public method

Specify $elemMatch criteria for the current field.
See also: Builder::elemMatch()
See also: http://docs.mongodb.org/manual/reference/operator/elemMatch/
public elemMatch ( array | Expr $expression )
$expression array | Expr
    public function elemMatch($expression)
    {
        return $this->operator('$elemMatch', $expression instanceof Expr ? $expression->getQuery() : $expression);
    }

Usage Example

示例#1
-1
 /**
  * Specify $elemMatch criteria for the current field.
  *
  * You can create a new expression using the {@link Builder::expr()} method.
  *
  * @see Expr::elemMatch()
  * @see http://docs.mongodb.org/manual/reference/operator/elemMatch/
  * @param array|Expr $expression
  * @return self
  */
 public function elemMatch($expression)
 {
     $this->expr->elemMatch($expression);
     return $this;
 }