private function executeCommand(Server $server)
    {
        $cmd = ['listIndexes' => $this->collectionName];

        if (isset($this->options['maxTimeMS'])) {
            $cmd['maxTimeMS'] = $this->options['maxTimeMS'];
        }

        try {
            $cursor = $server->executeCommand($this->databaseName, new Command($cmd), $this->createOptions());
        } catch (DriverRuntimeException $e) {
            /* The server may return an error if the collection does not exist.
             * Check for possible error codes (see: SERVER-20463) and return an
             * empty iterator instead of throwing.
             */
            if ($e->getCode() === self::$errorCodeNamespaceNotFound || $e->getCode() === self::$errorCodeDatabaseNotFound) {
                return new IndexInfoIteratorIterator(new EmptyIterator);
            }

            throw $e;
        }

        $cursor->setTypeMap(['root' => 'array', 'document' => 'array']);

        return new IndexInfoIteratorIterator(new CachingIterator($cursor));
    }
private function executeCommand(Server $server)
    {
        $cmd = ['listIndexes' => $this->collectionName];

        if (isset($this->options['maxTimeMS'])) {
            $cmd['maxTimeMS'] = $this->options['maxTimeMS'];
        }

        try {
            $cursor = $server->executeCommand($this->databaseName, new Command($cmd), $this->createOptions());
        } catch (DriverRuntimeException $e) {
            /* The server may return an error if the collection does not exist.
             * Check for possible error codes (see: SERVER-20463) and return an
             * empty iterator instead of throwing.
             */
            if ($e->getCode() === self::$errorCodeNamespaceNotFound || $e->getCode() === self::$errorCodeDatabaseNotFound) {
                return new IndexInfoIteratorIterator(new EmptyIterator);
            }

            throw $e;
        }

        $cursor->setTypeMap(['root' => 'array', 'document' => 'array']);

        return new IndexInfoIteratorIterator(new CachingIterator($cursor));
    }
private function executeCommand ( Server $ server ) { $ cmd = [ 'listIndexes' => $ this -> collectionName ] ; if ( isset ( $ this -> options [ 'maxTimeMS' ] ) ) { $ cmd [ 'maxTimeMS' ] = $ this -> options [ 'maxTimeMS' ] ; } try { $ cursor = $ server -> executeCommand ( $ this -> databaseName , new Command ( $ cmd ) , $ this -> createOptions ( ) ) ; } catch ( DriverRuntimeException $ e ) { /* The server may return an error if the collection does not exist.
             * Check for possible error codes (see: SERVER-20463) and return an
             * empty iterator instead of throwing.
             */ if ( $ e -> getCode ( ) === self :: $ errorCodeNamespaceNotFound || $ e -> getCode ( ) === self :: $ errorCodeDatabaseNotFound ) { return new IndexInfoIteratorIterator ( new EmptyIterator ) ; } throw $ e ; } $ cursor -> setTypeMap ( [ 'root' => 'array' , 'document' => 'array' ] ) ; return new IndexInfoIteratorIterator ( new CachingIterator ( $ cursor ) ) ; }
Returns information for all indexes for this collection using the
listIndexes command.

@param Server $server
@return IndexInfoIteratorIterator
@throws DriverRuntimeException for other driver errors (e.g. connection errors)
Returns information for all indexes for this collection using the listIndexes command .