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

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

## Description

Options related to a distributed transaction.

Supported fields include:

- max_commit_time_ms ("maxCommitTimeMS")
- read_concern ("readConcern")
- read_preference ("readPreference")
- write_concern ("writeConcern")

See also
  - Transactions (MongoDB Manual)

## Public Member Functions

| transaction_options ()
| Default initialization.
| transaction_options (transaction_options &&other) noexcept
| Move constructor.
| transaction_options (transaction_options const &other)
| Copy construction.
| ~transaction_options ()
| Destroy this object.
bsoncxx::v1::stdx::optional< std::chrono::milliseconds > | max_commit_time_ms () const
| Return the current "maxCommitTimeMS" field.
transaction_options & | max_commit_time_ms (std::chrono::milliseconds v)
| Set the "maxCommitTimeMS" field.
transaction_options & | operator= (transaction_options &&other) noexcept
| Move assignment.
transaction_options & | operator= (transaction_options const &other)
| Copy assignment.
bsoncxx::v1::stdx::optional< v1::read_concern > | read_concern () const
| Return the current "readConcern" field.
transaction_options & | read_concern (v1::read_concern const &v)
| Set the "readConcern" field.
bsoncxx::v1::stdx::optional< v1::read_preference > | read_preference () const
| Return the current "readPreference" field.
transaction_options & | read_preference (v1::read_preference const &v)
| Set the "readPreference" field.
bsoncxx::v1::stdx::optional< v1::write_concern > | write_concern () const
| Return the current "writeConcern" field.
transaction_options & | write_concern (v1::write_concern const &v)
| Set the "writeConcern" field.

## Constructor & Destructor Documentation

## ~transaction_options()

mongocxx::v1::transaction_options::~transaction_options | ( |  | ) |

Destroy this object.

Warning
  Invalidates all associated views.

## transaction_options() [1/3]

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

noexcept

Move constructor.

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

## transaction_options() [2/3]

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

Copy construction.

## transaction_options() [3/3]

mongocxx::v1::transaction_options::transaction_options | ( |  | ) |

Default initialization.

Postconditions:
  - All supported fields are "unset" or zero-initialized.

## Member Function Documentation

## max_commit_time_ms() [1/2]

bsoncxx::v1::stdx::optional< std::chrono::milliseconds > mongocxx::v1::transaction_options::max_commit_time_ms | ( |  | ) | const

Return the current "maxCommitTimeMS" field.

Note
  0 is equivalent to "unset".

## max_commit_time_ms() [2/2]

transaction_options & mongocxx::v1::transaction_options::max_commit_time_ms | ( | std::chrono::milliseconds | v | ) |

Set the "maxCommitTimeMS" field.

Note
  0 is equivalent to "unset".

## operator=() [1/2]

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

noexcept

Move assignment.

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

## operator=() [2/2]

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

Copy assignment.

## read_concern() [1/2]

bsoncxx::v1::stdx::optional< v1::read_concern > mongocxx::v1::transaction_options::read_concern | ( |  | ) | const

Return the current "readConcern" field.

## read_concern() [2/2]

transaction_options & mongocxx::v1::transaction_options::read_concern | ( | v1::read_concern const & | v | ) |

Set the "readConcern" field.

## read_preference() [1/2]

bsoncxx::v1::stdx::optional< v1::read_preference > mongocxx::v1::transaction_options::read_preference | ( |  | ) | const

Return the current "readPreference" field.

## read_preference() [2/2]

transaction_options & mongocxx::v1::transaction_options::read_preference | ( | v1::read_preference const & | v | ) |

Set the "readPreference" field.

## write_concern() [1/2]

bsoncxx::v1::stdx::optional< v1::write_concern > mongocxx::v1::transaction_options::write_concern | ( |  | ) | const

Return the current "writeConcern" field.

## write_concern() [2/2]

transaction_options & mongocxx::v1::transaction_options::write_concern | ( | v1::write_concern const & | v | ) |

Set the "writeConcern" field.

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

- mongocxx/v1/transaction_options.hpp