public function count($query = [], $options = [])
    {
        try {
            // Handle legacy mode - limit and skip as second and third parameters, respectively
            if (! is_array($options)) {
                $limit = $options;
                $options = [];

                if ($limit !== null) {
                    $options['limit'] = (int) $limit;
                }

                if (func_num_args() > 2) {
                    $options['skip'] = (int) func_get_args()[2];
                }
            }

            return $this->collection->count(TypeConverter::fromLegacy($query), $options);
        } catch (\MongoDB\Driver\Exception\Exception $e) {
            throw ExceptionConverter::toLegacy($e);
        }
    }
public function count($query = [], $options = [])
    {
        try {
            // Handle legacy mode - limit and skip as second and third parameters, respectively
            if (! is_array($options)) {
                $limit = $options;
                $options = [];

                if ($limit !== null) {
                    $options['limit'] = (int) $limit;
                }

                if (func_num_args() > 2) {
                    $options['skip'] = (int) func_get_args()[2];
                }
            }

            return $this->collection->count(TypeConverter::fromLegacy($query), $options);
        } catch (\MongoDB\Driver\Exception\Exception $e) {
            throw ExceptionConverter::toLegacy($e);
        }
    }
public function count ( $ query = [ ] , $ options = [ ] ) { try { // Handle legacy mode - limit and skip as second and third parameters, respectively if ( ! is_array ( $ options ) ) { $ limit = $ options ; $ options = [ ] ; if ( $ limit !== null ) { $ options [ 'limit' ] = ( int ) $ limit ; } if ( func_num_args ( ) > 2 ) { $ options [ 'skip' ] = ( int ) func_get_args ( ) [ 2 ] ; } } return $ this -> collection -> count ( TypeConverter :: fromLegacy ( $ query ) , $ options ) ; } catch ( \ MongoDB \ Driver \ Exception \ Exception $ e ) { throw ExceptionConverter :: toLegacy ( $ e ) ; } }
Counts the number of documents in this collection

@link http://www.php.net/manual/en/mongocollection.count.php
@param array|stdClass $query
@param array $options
@return int Returns the number of documents matching the query.
Counts the number of documents in this collection