MongoDB C++ Driver mongocxx-3.11.0
Loading...
Searching...
No Matches
mongocxx::v_noabi::options::client_session Class Reference

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

Description

Class representing the optional arguments to mongocxx::v_noabi::client::start_session.

Public Member Functions

bool causal_consistency () const noexcept
 Gets the value of the causal_consistency option.
 
client_sessioncausal_consistency (bool causal_consistency) noexcept
 Sets the causal_consistency option.
 
const stdx::optional< transaction > & default_transaction_opts () const
 Gets the current default transaction options.
 
client_sessiondefault_transaction_opts (transaction default_transaction_opts)
 Sets the default transaction options.
 
bool snapshot () const noexcept
 Gets the value of the snapshot_reads option.
 
client_sessionsnapshot (bool enable_snapshot_reads) noexcept
 Sets the read concern "snapshot" (not enabled by default).
 

Member Function Documentation

◆ causal_consistency() [1/2]

bool mongocxx::v_noabi::options::client_session::causal_consistency ( ) const
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)
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

◆ default_transaction_opts() [1/2]

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

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)

Sets the default transaction options.

Parameters
default_transaction_optsThe default transaction options.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.

◆ snapshot() [1/2]

bool mongocxx::v_noabi::options::client_session::snapshot ( ) const
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)
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
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: