MongoDB C++ Driver mongocxx-3.11.0
|
#include <mongocxx/v_noabi/mongocxx/bulk_write.hpp>
Class representing a batch of write operations that can be sent to the server as a group.
If you have a lot of write operations to execute, it can be more efficient to send them as part of a bulk_write in order to avoid unnecessary network-level round trips between the driver and the server.
Bulk writes affect a single collection only and are executed via the bulk_write::execute() method. Options that you would typically specify for individual write operations (such as write concern) are instead specified for the aggregate operation.
Public Member Functions | |
bulk_write (bulk_write &&) noexcept | |
Move constructs a bulk write operation. | |
~bulk_write () | |
Destroys a bulk write operation. | |
bulk_write & | append (const model::write &operation) |
Appends a single write to the bulk write operation. The write operation's contents are copied into the bulk operation completely, so there is no dependency between the life of an appended write operation and the bulk operation itself. | |
bool | empty () const noexcept |
Checks if a bulk write operation is empty. | |
stdx::optional< result::bulk_write > | execute () const |
Executes a bulk write. | |
bulk_write & | operator= (bulk_write &&) noexcept |
Move assigns a bulk write operation. | |
|
noexcept |
Move constructs a bulk write operation.
mongocxx::v_noabi::bulk_write::~bulk_write | ( | ) |
Destroys a bulk write operation.
bulk_write & mongocxx::v_noabi::bulk_write::append | ( | const model::write & | operation | ) |
Appends a single write to the bulk write operation. The write operation's contents are copied into the bulk operation completely, so there is no dependency between the life of an appended write operation and the bulk operation itself.
operation | The write operation to append (an instance of model::write) |
A model::write can be implicitly constructed from any of the following MongoDB models:
mongocxx::v_noabi::logic_error | if the given operation is invalid. |
|
noexcept |
Checks if a bulk write operation is empty.
stdx::optional< result::bulk_write > mongocxx::v_noabi::bulk_write::execute | ( | ) | const |
Executes a bulk write.
mongocxx::v_noabi::bulk_write_exception | when there are errors processing the writes. |
|
noexcept |
Move assigns a bulk write operation.