CreateIndexes
in package
implements
Executable
Operation for the createIndexes command.
Tags
Interfaces, Classes, Traits and Enums
- Executable
Table of Contents
- $collectionName : string
- $databaseName : string
- $indexes : array<string|int, mixed>
- $options : array<string|int, mixed>
- $wireVersionForCommitQuorum : int
- __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() : mixed
- Create one or more indexes for the collection using the createIndexes command.
Properties
$collectionName
private
string
$collectionName
$databaseName
private
string
$databaseName
$indexes
private
array<string|int, mixed>
$indexes
= []
$options
private
array<string|int, mixed>
$options
= []
$wireVersionForCommitQuorum
private
static int
$wireVersionForCommitQuorum
= 9
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:
-
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
Return values
mixed —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) : mixed
Parameters
- $server : Server