Phalcon\Db\Adapter\MongoDB\Collection::count PHP Method

count() public method

Gets the number of documents matching the filter.
See also: Count::__construct() for supported options
public count ( array | object $filter = [], array $options = [] ) : integer
$filter array | object Query by which to filter documents
$options array 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);
    }