public function execute(Server $server)
{
try {
$cursor = $server->executeCommand($this->databaseName, new Command(['drop' => $this->collectionName]));
} catch (RuntimeException $e) {
/* The server may return an error if the collection does not exist.
* Check for an error message (unfortunately, there isn't a code)
* and NOP instead of throwing.
*/
if ($e->getMessage() === self::$errorMessageNamespaceNotFound) {
return (object) ['ok' => 0, 'errmsg' => self::$errorMessageNamespaceNotFound];
}
throw $e;
}
if (isset($this->options['typeMap'])) {
$cursor->setTypeMap($this->options['typeMap']);
}
return current($cursor->toArray());
}