BulkWrite
final class BulkWrite implements Countable (View source)
The BulkWrite collects one or more write operations that should be sent to the server.
After adding any number of insert, update, and delete operations, the collection may be executed via Manager::executeBulkWrite(). Write operations may either be ordered (default) or unordered. Ordered write operations are sent to the server, in the order provided, for serial execution. If a write fails, any remaining operations will be aborted. Unordered operations are sent to the server in an arbitrary order where they may be executed in parallel. Any errors that occur are reported after all operations have been attempted.
Methods
Create a new BulkWrite Constructs a new ordered (default) or unordered BulkWrite.
No description
Count expected roundtrips for executing the bulk Returns the expected number of client-to-server roundtrips required to execute all write operations in the BulkWrite.
Add a delete operation to the bulk
Add an insert operation to the bulk
Add an update operation to the bulk
Details
final
__construct(array|null $options = null)
Create a new BulkWrite Constructs a new ordered (default) or unordered BulkWrite.
final
__wakeup()
No description
final int
count()
Count expected roundtrips for executing the bulk Returns the expected number of client-to-server roundtrips required to execute all write operations in the BulkWrite.
final void
delete(array|object $filter, array|null $deleteOptions = null)
Add a delete operation to the bulk
final mixed
insert(array|object $document)
Add an insert operation to the bulk
final
update(array|object $filter, array|object $newObj, array|null $updateOptions = null)
Add an update operation to the bulk