Skip to content

Commit 0dcdfba

Browse files
committed
PHPLIB-463: Make listCollections, listDatabases, and listIndexes operations retryable
1 parent 64e249a commit 0dcdfba

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Operation/ListCollections.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private function executeCommand(Server $server)
130130
$cmd['maxTimeMS'] = $this->options['maxTimeMS'];
131131
}
132132

133-
$cursor = $server->executeCommand($this->databaseName, new Command($cmd), $this->createOptions());
133+
$cursor = $server->executeReadCommand($this->databaseName, new Command($cmd), $this->createOptions());
134134
$cursor->setTypeMap(['root' => 'array', 'document' => 'array']);
135135

136136
return new CollectionInfoCommandIterator(new CachingIterator($cursor));

src/Operation/ListDatabases.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function execute(Server $server)
9898
$cmd['maxTimeMS'] = $this->options['maxTimeMS'];
9999
}
100100

101-
$cursor = $server->executeCommand('admin', new Command($cmd), $this->createOptions());
101+
$cursor = $server->executeReadCommand('admin', new Command($cmd), $this->createOptions());
102102
$cursor->setTypeMap(['root' => 'array', 'document' => 'array']);
103103
$result = current($cursor->toArray());
104104

src/Operation/ListIndexes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private function executeCommand(Server $server)
126126
}
127127

128128
try {
129-
$cursor = $server->executeCommand($this->databaseName, new Command($cmd), $this->createOptions());
129+
$cursor = $server->executeReadCommand($this->databaseName, new Command($cmd), $this->createOptions());
130130
} catch (DriverRuntimeException $e) {
131131
/* The server may return an error if the collection does not exist.
132132
* Check for possible error codes (see: SERVER-20463) and return an

0 commit comments

Comments
 (0)