Documentation

Distinct
in package
implements Executable, Explainable

Operation for the distinct command.

Tags
see
Collection::distinct()
see
http://docs.mongodb.org/manual/reference/command/distinct/

Interfaces, Classes, Traits and Enums

Executable
Explainable

Table of Contents

$collectionName  : string
$databaseName  : string
$fieldName  : string
$filter  : array<string|int, mixed>|object
$options  : array<string|int, mixed>
__construct()  : mixed
Constructs a distinct command.
execute()  : array<string|int, mixed>
Execute the operation.
getCommandDocument()  : array<string|int, mixed>
Returns the command document for this operation.
createCommandDocument()  : array<string|int, mixed>
Create the distinct command document.
createOptions()  : array<string|int, mixed>
Create options for executing the command.

Properties

$collectionName

private string $collectionName

$databaseName

private string $databaseName

$filter

private array<string|int, mixed>|object $filter

$options

private array<string|int, mixed> $options

Methods

__construct()

Constructs a distinct command.

public __construct(string $databaseName, string $collectionName, string $fieldName[, array<string|int, mixed>|object $filter = [] ][, array<string|int, mixed> $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
$databaseName : string

Database name

$collectionName : string

Collection name

$fieldName : string

Field for which to return distinct values

$filter : array<string|int, mixed>|object = []

Query by which to filter documents

$options : array<string|int, mixed> = []

Command options

Tags
throws
InvalidArgumentException

for parameter/option parsing errors

Return values
mixed

execute()

Execute the operation.

public execute(Server $server) : array<string|int, mixed>
Parameters
$server : Server
Tags
see
Executable::execute()
throws
UnexpectedValueException

if the command response was malformed

throws
UnsupportedException

if read concern is used and unsupported

throws
RuntimeException

for other driver errors (e.g. connection errors)

Return values
array<string|int, mixed>

getCommandDocument()

Returns the command document for this operation.

public getCommandDocument(Server $server) : array<string|int, mixed>
Parameters
$server : Server
Tags
see
Explainable::getCommandDocument()
Return values
array<string|int, mixed>

createCommandDocument()

Create the distinct command document.

private createCommandDocument() : array<string|int, mixed>
Return values
array<string|int, mixed>

Search results