Sokil\Mongo\Expression::whereElemMatch PHP Метод

whereElemMatch() публичный Метод

Matches documents in a collection that contain an array field with at least one element that matches all the specified query criteria.
public whereElemMatch ( string $field, Expression | callable | array $expression ) : Expression
$field string point-delimited field name
$expression Expression | callable | array
Результат Expression
    public function whereElemMatch($field, $expression)
    {
        if (is_callable($expression)) {
            $expression = call_user_func($expression, $this->expression());
        }
        if ($expression instanceof Expression) {
            $expression = $expression->toArray();
        } elseif (!is_array($expression)) {
            throw new Exception('Wrong expression passed');
        }
        return $this->where($field, array('$elemMatch' => $expression));
    }