MongoDB\Driver\Server::executeBulkWriteCommand
(mongodb >=2.1.0)
Execute write operations on this server using the bulkWrite command
Description
Executes one or more write operations on this server using the bulkWrite command introduced in MongoDB 8.0.
A MongoDB\Driver\BulkWriteCommand can be constructed with one or more write operations of varying types (e.g. inserts, updates, and deletes). Each write operation may target a different collection.
The default value for the "writeConcern" option will be inferred from an active transaction (indicated by the "session" option), followed by the connection URI.
Parameters
optionsOption Type Description
Return Values Bulkwritecommandresult
Errors/Exceptions
- Throws
MongoDB\Driver\Exception\InvalidArgumentExceptionifbulkdoes not contain any write operations. - Throws
MongoDB\Driver\Exception\InvalidArgumentExceptionifbulkhas already been executed.MongoDB\Driver\BulkWriteCommandobjects may not be executed multiple times. - Throws
MongoDB\Driver\Exception\RuntimeExceptionon other errors.
See Also
MongoDB\Driver\BulkWriteCommandMongoDB\Driver\BulkWriteCommandResultMongoDB\Driver\WriteConcernMongoDB\Driver\Manager::executeBulkWriteCommand()