Skip to content

Latest commit

 

History

History
238 lines (96 loc) · 2.79 KB

File metadata and controls

238 lines (96 loc) · 2.79 KB

Count

Operation for the count command.

See Also:

Properties

databaseName

private string $databaseName

collectionName

private string $collectionName

filter

private array|object $filter

options

private array $options

Methods

__construct

Constructs a count command.

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

Supported options:

  • collation (document): Collation specification.

  • hint (string|document): The index to use. Specify either the index name as a string or the index key pattern as a document. If specified, then the query system will only consider plans using the hinted index.

  • limit (integer): The maximum number of documents to count.

  • 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.

  • skip (integer): The number of documents to skip before returning the documents.

Parameters:

Parameter Type Description
$databaseName string Database name
$collectionName string Collection name
$filter array|object Query by which to filter documents
$options array Command options

execute

Execute the operation.

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

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 count command document.

private createCommandDocument(): array

createOptions

Create options for executing the command.

private createOptions(): array

See Also: