Phalcon\Db\Adapter\MongoDB\Operation\Distinct::__construct PHP Метод

__construct() публичный Метод

Supported options: * maxTimeMS (integer): The maximum amount of time to allow the query to run. * readConcern (MongoDB\Driver\ReadConcern): Read concern. For servers < 3.2, this option is ignored as read concern is not available. * readPreference (MongoDB\Driver\ReadPreference): Read preference.
public __construct ( string $databaseName, string $collectionName, string $fieldName, array | object $filter = [], array $options = [] )
$databaseName string Database name
$collectionName string Collection name
$fieldName string Field for which to return distinct values
$filter array | object Query by which to filter documents
$options array Command options
    public function __construct($databaseName, $collectionName, $fieldName, $filter = [], array $options = [])
    {
        if (!is_array($filter) && !is_object($filter)) {
            throw InvalidArgumentException::invalidType('$filter', $filter, 'array or object');
        }
        if (isset($options['maxTimeMS']) && !is_integer($options['maxTimeMS'])) {
            throw InvalidArgumentException::invalidType('"maxTimeMS" option', $options['maxTimeMS'], 'integer');
        }
        if (isset($options['readConcern']) && !$options['readConcern'] instanceof ReadConcern) {
            throw InvalidArgumentException::invalidType('"readConcern" option', $options['readConcern'], 'MongoDB\\Driver\\ReadConcern');
        }
        if (isset($options['readPreference']) && !$options['readPreference'] instanceof ReadPreference) {
            throw InvalidArgumentException::invalidType('"readPreference" option', $options['readPreference'], 'MongoDB\\Driver\\ReadPreference');
        }
        $this->databaseName = (string) $databaseName;
        $this->collectionName = (string) $collectionName;
        $this->fieldName = (string) $fieldName;
        $this->filter = $filter;
        $this->options = $options;
    }