Documentation

CreateIndexes
in package

FinalYes

Operation for the createIndexes command.

Tags
see
Collection::createIndex()
see
Collection::createIndexes()
see
https://mongodb.com/docs/manual/reference/command/createIndexes/

Table of Contents

Constants

WIRE_VERSION_FOR_COMMIT_QUORUM  = 9

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

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

for parameter/option parsing errors

execute()

Execute the operation.

public execute(Server $server) : array<string|int, string>
Parameters
$server : Server
Tags
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) : void
Parameters
$server : Server
Tags
throws
RuntimeException

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


        
On this page

Search results