src/League/Monga/Collection.php
public function count($query = [])
    {
        if ($query instanceof Closure) {
            $callback = $query;
            $query = new Query\Where();
            $callback($query);
        }

        if ($query instanceof Query\Where) {
            $query = $query->getWhere();
        }

        if (! is_array($query)) {
            throw new \InvalidArgumentException('The count query should be an array.');
        }

        return $this->collection->count($query);
    }
public function count($query = [])
    {
        if ($query instanceof Closure) {
            $callback = $query;
            $query = new Query\Where();
            $callback($query);
        }

        if ($query instanceof Query\Where) {
            $query = $query->getWhere();
        }

        if (! is_array($query)) {
            throw new \InvalidArgumentException('The count query should be an array.');
        }

        return $this->collection->count($query);
    }
public function count ( $ query = [ ] ) { if ( $ query instanceof Closure ) { $ callback = $ query ; $ query = new Query \ Where ( ) ; $ callback ( $ query ) ; } if ( $ query instanceof Query \ Where ) { $ query = $ query -> getWhere ( ) ; } if ( ! is_array ( $ query ) ) { throw new \ InvalidArgumentException ( 'The count query should be an array.' ) ; } return $ this -> collection -> count ( $ query ) ; }
Counts the given collection with an optional filter query

@param array|closure $query count filter

@return int number of documents
Counts the given collection with an optional filter query