Moodle PHP Documentation 4.1
Moodle 4.1.11 (Build: 20240610) (c8c84b4af18)
MongoDB\Operation\CreateIndexes Class Reference
Inheritance diagram for MongoDB\Operation\CreateIndexes:
MongoDB\Operation\Executable

Public Member Functions

 __construct (string $databaseName, string $collectionName, array $indexes, array $options=[])
 Constructs a createIndexes command.
 
 execute (Server $server)
 Execute the operation.
 

Constructor & Destructor Documentation

◆ __construct()

MongoDB\Operation\CreateIndexes::__construct ( string $databaseName,
string $collectionName,
array $indexes,
array $options = [] )

Constructs a createIndexes command.

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
string$databaseNameDatabase name
string$collectionNameCollection name
array[]$indexesList of index specifications
array$optionsCommand options
Exceptions
InvalidArgumentExceptionfor parameter/option parsing errors

Member Function Documentation

◆ execute()

MongoDB\Operation\CreateIndexes::execute ( Server $server)

Execute the operation.

See also
Executable\execute()
Return values
string[]The names of the created indexes
Exceptions
UnsupportedExceptionif write concern is used and unsupported
DriverRuntimeExceptionfor other driver errors (e.g. connection errors)

Implements MongoDB\Operation\Executable.


The documentation for this class was generated from the following file: