MongoDB C++ Driver  mongocxx-3.10.2
Public Member Functions | List of all members
mongocxx::v_noabi::options::client_session Class Reference

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

#include <client_session.hpp>

Public Member Functions

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

Detailed Description

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

Member Function Documentation

◆ causal_consistency()

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
https://www.mongodb.com/docs/manual/core/read-isolation-consistency-recency/#causal-consistency

◆ 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()

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
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: