execute() public method

Execute the operation.
See also: Executable::execute()
public execute ( MongoDB\Driver\Server $server ) : array | object
$server MongoDB\Driver\Server
return array | object Command result document
Example #1
0
 /**
  * Drop a database.
  *
  * @see DropDatabase::__construct() for supported options
  *
  * @param string $databaseName Database name
  * @param array  $options Additional options
  *
  * @return array|object Command result document
  */
 public function dropDatabase($databaseName, array $options = [])
 {
     if (!isset($options['typeMap'])) {
         $options['typeMap'] = $this->typeMap;
     }
     $operation = new DropDatabase($databaseName, $options);
     $server = $this->manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY));
     return $operation->execute($server);
 }