public function count($foundOnly = false)
    {
        $optionNames = ['hint', 'maxTimeMS'];
        if ($foundOnly) {
            $optionNames = array_merge($optionNames, ['limit', 'skip']);
        }

        $options = $this->getOptions($optionNames) + $this->options;
        try {
            $count = $this->collection->count(TypeConverter::fromLegacy($this->query), $options);
        } catch (\MongoDB\Driver\Exception\ExecutionTimeoutException $e) {
            throw new MongoCursorTimeoutException($e->getMessage(), $e->getCode(), $e);
        } catch (\MongoDB\Driver\Exception\Exception $e) {
            throw ExceptionConverter::toLegacy($e);
        }

        return $count;
    }
public function count($foundOnly = false)
    {
        $optionNames = ['hint', 'maxTimeMS'];
        if ($foundOnly) {
            $optionNames = array_merge($optionNames, ['limit', 'skip']);
        }

        $options = $this->getOptions($optionNames) + $this->options;
        try {
            $count = $this->collection->count(TypeConverter::fromLegacy($this->query), $options);
        } catch (\MongoDB\Driver\Exception\ExecutionTimeoutException $e) {
            throw new MongoCursorTimeoutException($e->getMessage(), $e->getCode(), $e);
        } catch (\MongoDB\Driver\Exception\Exception $e) {
            throw ExceptionConverter::toLegacy($e);
        }

        return $count;
    }
public function count ( $ foundOnly = false ) { $ optionNames = [ 'hint' , 'maxTimeMS' ] ; if ( $ foundOnly ) { $ optionNames = array_merge ( $ optionNames , [ 'limit' , 'skip' ] ) ; } $ options = $ this -> getOptions ( $ optionNames ) + $ this -> options ; try { $ count = $ this -> collection -> count ( TypeConverter :: fromLegacy ( $ this -> query ) , $ options ) ; } catch ( \ MongoDB \ Driver \ Exception \ ExecutionTimeoutException $ e ) { throw new MongoCursorTimeoutException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } catch ( \ MongoDB \ Driver \ Exception \ Exception $ e ) { throw ExceptionConverter :: toLegacy ( $ e ) ; } return $ count ; }
Counts the number of results for this query
@link http://www.php.net/manual/en/mongocursor.count.php
@param bool $foundOnly Send cursor limit and skip information to the count function, if applicable.
@return int The number of documents returned by this cursor's query.
Counts the number of results for this query