execute() public méthode

Execute the operation.
See also: Executable::execute()
public execute ( MongoDB\Driver\Server $server ) : integer
$server MongoDB\Driver\Server
Résultat integer
Exemple #1
0
 /**
  * Gets the number of documents matching the filter.
  *
  * @see Count::__construct() for supported options
  *
  * @param array|object $filter Query by which to filter documents
  * @param array        $options Command options
  *
  * @return integer
  */
 public function count($filter = [], array $options = [])
 {
     if (!isset($options['readConcern'])) {
         $options['readConcern'] = $this->readConcern;
     }
     if (!isset($options['readPreference'])) {
         $options['readPreference'] = $this->readPreference;
     }
     $operation = new Count($this->databaseName, $this->collectionName, $filter, $options);
     $server = $this->manager->selectServer($options['readPreference']);
     return $operation->execute($server);
 }