Loading...
Searching...
No Matches
mongocxx::v1::client_bulk_write Class Reference

`#include <mongocxx/v1/client_bulk_write.hpp>`

## Description

A list of bulk write operations. Unlike mongocxx::v1::bulk_write, this supports writes across more than one collection and can group inserts, updates, and deletes in the same network payload.

Note
  mongocxx::v1::client_bulk_write uses the bulkWrite server command. The bulkWrite command is only available on MongoDB servers 8.0 and newer.

See also
  - Bulk Write Operations (MongoDB Manual)
  - bulkWrite (MongoDB Manual)

## Classes

class | delete_many_options
| Options for a "Delete Many" operation in a client bulk write. More...
class | delete_one_options
| Options for a "Delete One" operation in a client bulk write. More...
class | exception
| A client bulk write error. More...
class | insert_one_options
| Options for an "Insert One" operation in a client bulk write. More...
class | options
| Options for a client bulk write operation. More...
class | replace_one_options
| Options for a "Replace One" operation in a client bulk write. More...
class | result
| The result of a client bulk write operation. More...
class | update_many_options
| Options for an "Update Many" operation in a client bulk write. More...
class | update_one_options
| Options for an "Update One" operation in a client bulk write. More...

## Public Member Functions

| client_bulk_write (client_bulk_write &&other) noexcept
| Move constructor.
| client_bulk_write (client_bulk_write const &other)=delete
| This class is not copyable.
| ~client_bulk_write ()
| Destroy this object.
client_bulk_write & | append (bsoncxx::v1::stdx::string_view ns, bsoncxx::v1::document::view document, insert_one_options const &opts)
| Append an "Insert One" operation targeting the given namespace.
client_bulk_write & | append (bsoncxx::v1::stdx::string_view ns, bsoncxx::v1::document::view filter, bsoncxx::v1::document::view replacement, replace_one_options const &opts)
| Append a "Replace One" operation targeting the given namespace.
client_bulk_write & | append (bsoncxx::v1::stdx::string_view ns, bsoncxx::v1::document::view filter, bsoncxx::v1::document::view update, update_many_options const &opts)
| Append an "Update Many" operation targeting the given namespace.
client_bulk_write & | append (bsoncxx::v1::stdx::string_view ns, bsoncxx::v1::document::view filter, bsoncxx::v1::document::view update, update_one_options const &opts)
| Append an "Update One" operation targeting the given namespace.
client_bulk_write & | append (bsoncxx::v1::stdx::string_view ns, bsoncxx::v1::document::view filter, delete_many_options const &opts)
| Append a "Delete Many" operation targeting the given namespace.
client_bulk_write & | append (bsoncxx::v1::stdx::string_view ns, bsoncxx::v1::document::view filter, delete_one_options const &opts)
| Append a "Delete One" operation targeting the given namespace.
client_bulk_write & | append (bsoncxx::v1::stdx::string_view ns, bsoncxx::v1::document::view filter, v1::pipeline const &update, update_many_options const &opts)
| Append an "Update Many" operation with an aggregation pipeline targeting the given namespace.
client_bulk_write & | append (bsoncxx::v1::stdx::string_view ns, bsoncxx::v1::document::view filter, v1::pipeline const &update, update_one_options const &opts)
| Append an "Update One" operation with an aggregation pipeline targeting the given namespace.
bsoncxx::v1::stdx::optional< result > | execute (options const &opts)
| Execute the appended operations.
client_bulk_write & | operator= (client_bulk_write &&other) noexcept
| Move assignment.
client_bulk_write & | operator= (client_bulk_write const &other)=delete
| This class is not copyable.

## Constructor & Destructor Documentation

## ~client_bulk_write()

mongocxx::v1::client_bulk_write::~client_bulk_write | ( |  | ) |

Destroy this object.

## client_bulk_write() [1/2]

mongocxx::v1::client_bulk_write::client_bulk_write | ( | client_bulk_write && | other | ) |

noexcept

Move constructor.

Postconditions:
  - other is in an assign-or-destroy-only state.

## client_bulk_write() [2/2]

mongocxx::v1::client_bulk_write::client_bulk_write | ( | client_bulk_write const & | other | ) |

delete

This class is not copyable.

## Member Function Documentation

## append() [1/8]

client_bulk_write & mongocxx::v1::client_bulk_write::append | ( | bsoncxx::v1::stdx::string_view | ns,
|  | bsoncxx::v1::document::view | document,
|  | insert_one_options const & | opts )

Append an "Insert One" operation targeting the given namespace.

Exceptions

  mongocxx::v1::exception | when a client-side error is encountered.

## append() [2/8]

client_bulk_write & mongocxx::v1::client_bulk_write::append | ( | bsoncxx::v1::stdx::string_view | ns,
|  | bsoncxx::v1::document::view | filter,
|  | bsoncxx::v1::document::view | replacement,
|  | replace_one_options const & | opts )

Append a "Replace One" operation targeting the given namespace.

Exceptions

  mongocxx::v1::exception | when a client-side error is encountered.

## append() [3/8]

client_bulk_write & mongocxx::v1::client_bulk_write::append | ( | bsoncxx::v1::stdx::string_view | ns,
|  | bsoncxx::v1::document::view | filter,
|  | bsoncxx::v1::document::view | update,
|  | update_many_options const & | opts )

Append an "Update Many" operation targeting the given namespace.

Exceptions

  mongocxx::v1::exception | when a client-side error is encountered.

## append() [4/8]

client_bulk_write & mongocxx::v1::client_bulk_write::append | ( | bsoncxx::v1::stdx::string_view | ns,
|  | bsoncxx::v1::document::view | filter,
|  | bsoncxx::v1::document::view | update,
|  | update_one_options const & | opts )

Append an "Update One" operation targeting the given namespace.

Exceptions

  mongocxx::v1::exception | when a client-side error is encountered.

## append() [5/8]

client_bulk_write & mongocxx::v1::client_bulk_write::append | ( | bsoncxx::v1::stdx::string_view | ns,
|  | bsoncxx::v1::document::view | filter,
|  | delete_many_options const & | opts )

Append a "Delete Many" operation targeting the given namespace.

Exceptions

  mongocxx::v1::exception | when a client-side error is encountered.

## append() [6/8]

client_bulk_write & mongocxx::v1::client_bulk_write::append | ( | bsoncxx::v1::stdx::string_view | ns,
|  | bsoncxx::v1::document::view | filter,
|  | delete_one_options const & | opts )

Append a "Delete One" operation targeting the given namespace.

Exceptions

  mongocxx::v1::exception | when a client-side error is encountered.

## append() [7/8]

client_bulk_write & mongocxx::v1::client_bulk_write::append | ( | bsoncxx::v1::stdx::string_view | ns,
|  | bsoncxx::v1::document::view | filter,
|  | v1::pipeline const & | update,
|  | update_many_options const & | opts )

Append an "Update Many" operation with an aggregation pipeline targeting the given namespace.

Exceptions

  mongocxx::v1::exception | when a client-side error is encountered.

## append() [8/8]

client_bulk_write & mongocxx::v1::client_bulk_write::append | ( | bsoncxx::v1::stdx::string_view | ns,
|  | bsoncxx::v1::document::view | filter,
|  | v1::pipeline const & | update,
|  | update_one_options const & | opts )

Append an "Update One" operation with an aggregation pipeline targeting the given namespace.

Exceptions

  mongocxx::v1::exception | when a client-side error is encountered.

## execute()

bsoncxx::v1::stdx::optional< result > mongocxx::v1::client_bulk_write::execute | ( | options const & | opts | ) |

Execute the appended operations.

Returns
  Empty when the bulk write operation is unacknowledged.

Exceptions

  mongocxx::v1::client_bulk_write::exception | when a bulk write error is encountered.
  mongocxx::v1::exception | for all other runtime errors.

## operator=() [1/2]

client_bulk_write & mongocxx::v1::client_bulk_write::operator= | ( | client_bulk_write && | other | ) |

noexcept

Move assignment.

Postconditions:
  - other is in an assign-or-destroy-only state.

## operator=() [2/2]

client_bulk_write & mongocxx::v1::client_bulk_write::operator= | ( | client_bulk_write const & | other | ) |

delete

This class is not copyable.

The documentation for this class was generated from the following file:

- mongocxx/v1/client_bulk_write.hpp