PHPLIB-463: Make listCollections, listDatabases, and listIndexes operations retryable

parent 64e249af
...@@ -130,7 +130,7 @@ class ListCollections implements Executable ...@@ -130,7 +130,7 @@ class ListCollections implements Executable
$cmd['maxTimeMS'] = $this->options['maxTimeMS']; $cmd['maxTimeMS'] = $this->options['maxTimeMS'];
} }
$cursor = $server->executeCommand($this->databaseName, new Command($cmd), $this->createOptions()); $cursor = $server->executeReadCommand($this->databaseName, new Command($cmd), $this->createOptions());
$cursor->setTypeMap(['root' => 'array', 'document' => 'array']); $cursor->setTypeMap(['root' => 'array', 'document' => 'array']);
return new CollectionInfoCommandIterator(new CachingIterator($cursor)); return new CollectionInfoCommandIterator(new CachingIterator($cursor));
......
...@@ -98,7 +98,7 @@ class ListDatabases implements Executable ...@@ -98,7 +98,7 @@ class ListDatabases implements Executable
$cmd['maxTimeMS'] = $this->options['maxTimeMS']; $cmd['maxTimeMS'] = $this->options['maxTimeMS'];
} }
$cursor = $server->executeCommand('admin', new Command($cmd), $this->createOptions()); $cursor = $server->executeReadCommand('admin', new Command($cmd), $this->createOptions());
$cursor->setTypeMap(['root' => 'array', 'document' => 'array']); $cursor->setTypeMap(['root' => 'array', 'document' => 'array']);
$result = current($cursor->toArray()); $result = current($cursor->toArray());
......
...@@ -126,7 +126,7 @@ class ListIndexes implements Executable ...@@ -126,7 +126,7 @@ class ListIndexes implements Executable
} }
try { try {
$cursor = $server->executeCommand($this->databaseName, new Command($cmd), $this->createOptions()); $cursor = $server->executeReadCommand($this->databaseName, new Command($cmd), $this->createOptions());
} catch (DriverRuntimeException $e) { } catch (DriverRuntimeException $e) {
/* The server may return an error if the collection does not exist. /* The server may return an error if the collection does not exist.
* Check for possible error codes (see: SERVER-20463) and return an * Check for possible error codes (see: SERVER-20463) and return an
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment