CreateIndexes
in package
Operation for the createIndexes command.
Tags
Table of Contents
Constants
Properties
- $collectionName : string
- $databaseName : string
- $indexes : array<int, IndexInput>
- $options : array<string|int, mixed>
Methods
- __construct() : mixed
- Constructs a createIndexes command.
- execute() : array<string|int, string>
- Execute the operation.
- createOptions() : array<string|int, mixed>
- Create options for executing the command.
- executeCommand() : void
- Create one or more indexes for the collection using the createIndexes command.
Constants
WIRE_VERSION_FOR_COMMIT_QUORUM
private
mixed
WIRE_VERSION_FOR_COMMIT_QUORUM
= 9
Properties
$collectionName
private
string
$collectionName
$databaseName
private
string
$databaseName
$indexes
private
array<int, IndexInput>
$indexes
= []
$options
private
array<string|int, mixed>
$options
= []
Methods
__construct()
Constructs a createIndexes command.
public
__construct(string $databaseName, string $collectionName, array<string|int, array<string|int, mixed>> $indexes[, array<string|int, mixed> $options = [] ]) : mixed
Supported options:
-
comment (mixed): BSON value to attach as a comment to this command.
This is not supported for servers versions < 4.4.
-
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
- $databaseName : string
-
Database name
- $collectionName : string
-
Collection name
- $indexes : array<string|int, array<string|int, mixed>>
-
List of index specifications
- $options : array<string|int, mixed> = []
-
Command options
Tags
execute()
Execute the operation.
public
execute(Server $server) : array<string|int, string>
Parameters
- $server : Server
Tags
Return values
array<string|int, string> —The names of the created indexes
createOptions()
Create options for executing the command.
private
createOptions() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>executeCommand()
Create one or more indexes for the collection using the createIndexes command.
private
executeCommand(Server $server) : void
Parameters
- $server : Server