Moodle PHP Documentation 4.1
Moodle 4.1.11 (Build: 20240610) (c8c84b4af18)
|
Public Member Functions | |
__construct (string $databaseName, string $collectionName, array $operations, array $options=[]) | |
Constructs a bulk write operation. | |
execute (Server $server) | |
Execute the operation. | |
MongoDB\Operation\BulkWrite::__construct | ( | string | $databaseName, |
string | $collectionName, | ||
array | $operations, | ||
array | $options = [] ) |
Constructs a bulk write operation.
Example array structure for all supported operation types:
[ [ 'deleteMany' => [ $filter, $options ] ], [ 'deleteOne' => [ $filter, $options ] ], [ 'insertOne' => [ $document ] ], [ 'replaceOne' => [ $filter, $replacement, $options ] ], [ 'updateMany' => [ $filter, $update, $options ] ], [ 'updateOne' => [ $filter, $update, $options ] ], ]
Arguments correspond to the respective Operation classes; however, the writeConcern option is specified for the top-level bulk write operation instead of each individual operation.
Supported options for deleteMany and deleteOne operations:
Supported options for replaceOne, updateMany, and updateOne operations:
Supported options for updateMany and updateOne operations:
Supported options for the bulk write operation:
comment (mixed): BSON value to attach as a comment to this command(s) associated with this bulk write.
This is not supported for servers versions < 4.4.
string | $databaseName | Database name |
string | $collectionName | Collection name |
array[] | $operations | List of write operations |
array | $options | Command options |
InvalidArgumentException | for parameter/option parsing errors |
MongoDB\Operation\BulkWrite::execute | ( | Server | $server | ) |
Execute the operation.
BulkWriteResult |
UnsupportedException | if write concern is used and unsupported |
DriverRuntimeException | for other driver errors (e.g. connection errors) |
Implements MongoDB\Operation\Executable.