Documentation

CreateIndexes
in package
implements Executable

Operation for the createIndexes command.

Tags
see
Collection::createIndex()
see
Collection::createIndexes()
see
http://docs.mongodb.org/manual/reference/command/createIndexes/

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

$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
throws
InvalidArgumentException

for parameter/option parsing errors

Return values
mixed

execute()

Execute the operation.

public execute(Server $server) : array<string|int, string>
Parameters
$server : Server
Tags
see
Executable::execute()
throws
UnsupportedException

if write concern is used and unsupported

throws
RuntimeException

for other driver errors (e.g. connection errors)

Return values
array<string|int, string>

The names of the created indexes

executeCommand()

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

private executeCommand(Server $server) : mixed
Parameters
$server : Server
Tags
throws
RuntimeException

for other driver errors (e.g. connection errors)

Return values
mixed

Search results