Operation for the createIndexes command.
- Full name:
\MongoDB\Operation\CreateIndexes
- This class implements:
\MongoDB\Operation\Executable
See Also:
- \MongoDB\Collection::createIndex() -
- \MongoDB\Collection::createIndexes() -
- http://docs.mongodb.org/manual/reference/command/createIndexes/ -
private static int $wireVersionForCommitQuorum
- This property is static.
private string $databaseName
private string $collectionName
private array $indexes
private array $options
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 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() -
Create options for executing the command.
private createOptions(): array
See Also:
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 |