Skip to content

Latest commit

 

History

History
227 lines (93 loc) · 2.55 KB

CreateIndexes.md

File metadata and controls

227 lines (93 loc) · 2.55 KB

CreateIndexes

Operation for the createIndexes command.

See Also:

Properties

wireVersionForCommitQuorum

private static int $wireVersionForCommitQuorum
  • This property is static.

databaseName

private string $databaseName

collectionName

private string $collectionName

indexes

private array $indexes

options

private array $options

Methods

__construct

Constructs a createIndexes command.

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

Supported options:

  • commitQuorum (integer|string): Specifies how many data-bearing members of a replica set, including the primary, must complete the index builds successfully before the primary marks the indexes as ready.

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

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

  • writeConcern (MongoDB\Driver\WriteConcern): Write concern.

Parameters:

Parameter Type Description
$databaseName string Database name
$collectionName string Collection name
$indexes array[] List of index specifications
$options array Command options

execute

Execute the operation.

public execute(\MongoDB\Driver\Server $server): string[]

Parameters:

Parameter Type Description
$server \MongoDB\Driver\Server

Return Value:

The names of the created indexes

See Also:

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

createOptions

Create options for executing the command.

private createOptions(): array

See Also:


executeCommand

Create one or more indexes for the collection using the createIndexes command.

private executeCommand(\MongoDB\Driver\Server $server): mixed

Parameters:

Parameter Type Description
$server \MongoDB\Driver\Server