Skip to content

Latest commit

 

History

History
247 lines (97 loc) · 2.67 KB

Distinct.md

File metadata and controls

247 lines (97 loc) · 2.67 KB

Distinct

Operation for the distinct command.

See Also:

Properties

databaseName

private string $databaseName

collectionName

private string $collectionName

fieldName

private string $fieldName

filter

private array|object $filter

options

private array $options

Methods

__construct

Constructs a distinct command.

public __construct(string $databaseName, string $collectionName, string $fieldName, array|object $filter = [], array $options = []): mixed

Supported options:

  • collation (document): Collation specification.

  • maxTimeMS (integer): The maximum amount of time to allow the query to run.

  • readConcern (MongoDB\Driver\ReadConcern): Read concern.

  • readPreference (MongoDB\Driver\ReadPreference): Read preference.

  • session (MongoDB\Driver\Session): Client session.

  • typeMap (array): Type map for BSON deserialization.

Parameters:

Parameter Type Description
$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

execute

Execute the operation.

public execute(\MongoDB\Driver\Server $server): array

Parameters:

Parameter Type Description
$server \MongoDB\Driver\Server

See Also:

  • \MongoDB\Operation\Executable::execute() -

getCommandDocument

Returns the command document for this operation.

public getCommandDocument(\MongoDB\Driver\Server $server): array

Parameters:

Parameter Type Description
$server \MongoDB\Driver\Server

See Also:

  • \MongoDB\Operation\Explainable::getCommandDocument() -

createCommandDocument

Create the distinct command document.

private createCommandDocument(): array

createOptions

Create options for executing the command.

private createOptions(): array

See Also: