public function match($expression)
    {
        if (is_callable($expression)) {
            $expressionConfigurator = $expression;
            $expression = new Expression();
            call_user_func($expressionConfigurator, $expression);
        }

        if ($expression instanceof Expression) {
            $expression = $expression->toArray();
        } elseif (!is_array($expression)) {
            throw new Exception('Must be array, callable or instance of \Sokil\Mongo\Expression');
        }

        $this->addStage('$match', $expression);
        return $this;
    }
public function match($expression)
    {
        if (is_callable($expression)) {
            $expressionConfigurator = $expression;
            $expression = new Expression();
            call_user_func($expressionConfigurator, $expression);
        }

        if ($expression instanceof Expression) {
            $expression = $expression->toArray();
        } elseif (!is_array($expression)) {
            throw new Exception('Must be array, callable or instance of \Sokil\Mongo\Expression');
        }

        $this->addStage('$match', $expression);
        return $this;
    }
public function match ( $ expression ) { if ( is_callable ( $ expression ) ) { $ expressionConfigurator = $ expression ; $ expression = new Expression ( ) ; call_user_func ( $ expressionConfigurator , $ expression ) ; } if ( $ expression instanceof Expression ) { $ expression = $ expression -> toArray ( ) ; } elseif ( ! is_array ( $ expression ) ) { throw new Exception ( 'Must be array, callable or instance of \Sokil\Mongo\Expression' ) ; } $ this -> addStage ( '$match' , $ expression ) ; return $ this ; }
Filter documents by expression

@param array|\Sokil\Mongo\Expression $expression
@return \Sokil\Mongo\Pipeline
@throws \Sokil\Mongo\Exception
Filter documents by expression