Loading...
Searching...
No Matches
mongocxx::v_noabi::options::client_session Class Reference

`#include <mongocxx/v_noabi/mongocxx/options/client_session.hpp>`

## Description

Used by client sessions.

## Public Member Functions

| client_session ()=default
| Default initialization.
| client_session (v1::client_session::options const &opts)
| Construct with the mongocxx::v1 equivalent.
bool | causal_consistency () const noexcept
| Gets the value of the causal_consistency option.
client_session & | causal_consistency (bool causal_consistency) noexcept
| Sets the causal_consistency option.
bsoncxx::v_noabi::stdx::optional< transaction > const & | default_transaction_opts () const
| Gets the current default transaction options.
client_session & | default_transaction_opts (transaction default_transaction_opts)
| Sets the default transaction options.
| operator v1::client_session::options () const
| Convert to the mongocxx::v1 equivalent.
bool | snapshot () const noexcept
| Gets the value of the snapshot_reads option.
client_session & | snapshot (bool enable_snapshot_reads) noexcept
| Sets the read concern "snapshot" (not enabled by default).

## Constructor & Destructor Documentation

## client_session() [1/2]

mongocxx::v_noabi::options::client_session::client_session | ( |  | ) |

default

Default initialization.

## client_session() [2/2]

mongocxx::v_noabi::options::client_session::client_session | ( | v1::client_session::options const & | opts | ) |

inline

Construct with the mongocxx::v1 equivalent.

## Member Function Documentation

## causal_consistency() [1/2]

bool mongocxx::v_noabi::options::client_session::causal_consistency | ( |  | ) | const

inline noexcept

Gets the value of the causal_consistency option.

## causal_consistency() [2/2]

client_session & mongocxx::v_noabi::options::client_session::causal_consistency | ( | bool | causal_consistency | ) |

inline noexcept

Sets the causal_consistency option.

If true (the default), each operation in the session will be causally ordered after the previous read or write operation. Set to false to disable causal consistency.

Unacknowledged writes are not causally consistent. If you execute a write operation with an unacknowledged write concern (a mongocxx::v_noabi::write_concern with mongocxx::v_noabi::write_concern::acknowledge_level of `k_unacknowledged`), the write does not participate in causal consistency.

Returns
  A reference to the object on which this member function is being called. This facilitates method chaining.

See also
  - https://www.mongodb.com/docs/manual/core/read-isolation-consistency-recency/#causal-consistency

## default_transaction_opts() [1/2]

bsoncxx::v_noabi::stdx::optional< transaction > const & mongocxx::v_noabi::options::client_session::default_transaction_opts | ( |  | ) | const

inline

Gets the current default transaction options.

Returns
  The default transaction options.

## default_transaction_opts() [2/2]

client_session & mongocxx::v_noabi::options::client_session::default_transaction_opts | ( | transaction | default_transaction_opts | ) |

inline

Sets the default transaction options.

Parameters

  default_transaction_opts | The default transaction options.

Returns
  A reference to the object on which this member function is being called. This facilitates method chaining.

## operator v1::client_session::options()

mongocxx::v_noabi::options::client_session::operator v1::client_session::options | ( |  | ) | const

inline explicit

Convert to the mongocxx::v1 equivalent.

## snapshot() [1/2]

bool mongocxx::v_noabi::options::client_session::snapshot | ( |  | ) | const

inline noexcept

Gets the value of the snapshot_reads option.

## snapshot() [2/2]

client_session & mongocxx::v_noabi::options::client_session::snapshot | ( | bool | enable_snapshot_reads | ) |

inline noexcept

Sets the read concern "snapshot" (not enabled by default).

Returns
  A reference to the object on which this member function is being called. This facilitates method chaining.

See also
  - https://www.mongodb.com/docs/manual/reference/read-concern-snapshot/

Note
  Snapshot reads and causal consistency are mutually exclusive: only one or the other may be active at a time. Attempting to do so will result in an error being thrown by mongocxx::v_noabi::client::start_session.

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

- mongocxx/v_noabi/mongocxx/options/client_session.hpp