php8.5
Home/ Manual/ driver / server/ MongoDB\Driver\Server::executeBulkWriteCommand

MongoDB\Driver\Server::executeBulkWriteCommand

PHP function Edit on GitHub ✎

(mongodb >=2.1.0)

Execute write operations on this server using the bulkWrite command

Description

MongoDB\Driver\Server::executeBulkWriteCommand(MongoDB\Driver\BulkWriteCommand $bulk, array|null $options = null): MongoDB\Driver\BulkWriteCommandResult

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

options
OptionTypeDescription

Return Values Bulkwritecommandresult

Errors/Exceptions

  • Throws MongoDB\Driver\Exception\InvalidArgumentException if bulk does not contain any write operations.
  • Throws MongoDB\Driver\Exception\InvalidArgumentException if bulk has already been executed. MongoDB\Driver\BulkWriteCommand objects may not be executed multiple times.
  • Throws MongoDB\Driver\Exception\RuntimeException on other errors.

See Also

Source: reference/mongodb/mongodb/driver/server/executebulkwritecommand.xml · from the official PHP manual (php/doc-en)