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;
}