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

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

## Description

Options related to a MongoDB Read Concern.

Supported fields include:

- level

See also
  - Read Concern (MongoDB Manual)
  - Default MongoDB Read Concerns/Write Concerns (MongoDB Manual)

## Public Types

enum class | level
| The read concern level. More...

## Public Member Functions

| read_concern ()
| Default initialization.
| read_concern (read_concern &&other) noexcept
| Move constructor.
| read_concern (read_concern const &other)
| Copy construction.
| ~read_concern ()
| Destroy this object.
level | acknowledge_level () const
| Return the current read concern level.
read_concern & | acknowledge_level (level v)
| Set the read concern level.
bsoncxx::v1::stdx::string_view | acknowledge_string () const
| Return the current read concern level as a string.
read_concern & | acknowledge_string (bsoncxx::v1::stdx::string_view v)
| Set the read concern level to an arbitrary string.
read_concern & | operator= (read_concern &&other) noexcept
| Move assignment.
read_concern & | operator= (read_concern const &other)
| Copy assignment.
bsoncxx::v1::document::value | to_document () const
| Return this read concern option as a document.

## Friends

bool | operator== (read_concern const &lhs, read_concern const &rhs)
| Compare equal when all supported fields compare equal.
bool | operator!= (read_concern const &lhs, read_concern const &rhs)
| Compare equal when all supported fields compare equal.

## Member Enumeration Documentation

## level

enum class mongocxx::v1::read_concern::level

strong

The read concern level.

See also
  - Read Concern (MongoDB Manual)

Enumerator
k_local | Read Concern "local" (MongoDB Manual)
k_majority | Read Concern "majority" (MongoDB Manual)
k_linearizable | Read Concern "linearizable" (MongoDB Manual)
k_server_default | Default MongoDB Read Concerns/Write Concerns (MongoDB Manual)

k_unknown

An unknown (unsupported) read concern level.

Note
  Not to be confused with level::k_server_default.

k_available | Read Concern "available" (MongoDB Manual)
k_snapshot | Read Concern "snapshot" (MongoDB Manual)

## Constructor & Destructor Documentation

## ~read_concern()

mongocxx::v1::read_concern::~read_concern | ( |  | ) |

Destroy this object.

Warning
  Invalidates all associated views.

## read_concern() [1/3]

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

noexcept

Move constructor.

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

## read_concern() [2/3]

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

Copy construction.

## read_concern() [3/3]

mongocxx::v1::read_concern::read_concern | ( |  | ) |

Default initialization.

Postconditions:
  - this->level() == k_server_default

## Member Function Documentation

## acknowledge_level() [1/2]

level mongocxx::v1::read_concern::acknowledge_level | ( |  | ) | const

Return the current read concern level.

## acknowledge_level() [2/2]

read_concern & mongocxx::v1::read_concern::acknowledge_level | ( | level | v | ) |

Set the read concern level.

Parameters

  v

  One of:
  - level::k_local
  - level::k_majority
  - level::k_linearizable
  - level::k_server_default
  - level::k_available
  - level::k_snapshot

## acknowledge_string() [1/2]

bsoncxx::v1::stdx::string_view mongocxx::v1::read_concern::acknowledge_string | ( |  | ) | const

Return the current read concern level as a string.

Returns
  Empty when this->acknowledge_level() is level::k_server_default or level::k_unknown.

## acknowledge_string() [2/2]

read_concern & mongocxx::v1::read_concern::acknowledge_string | ( | bsoncxx::v1::stdx::string_view | v | ) |

Set the read concern level to an arbitrary string.

Parameters

  v | Equivalent to this->acknowledge_level(k_server_default) when v is empty.

## operator=() [1/2]

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

noexcept

Move assignment.

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

## operator=() [2/2]

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

Copy assignment.

## to_document()

bsoncxx::v1::document::value mongocxx::v1::read_concern::to_document | ( |  | ) | const

Return this read concern option as a document.

Preconditions:
  - this->acknowledge_level() != level::k_unknown.

## Friends And Related Symbol Documentation

## operator!=

bool operator!= | ( | read_concern const & | lhs,
|  | read_concern const & | rhs )

friend

Compare equal when all supported fields compare equal.

## operator==

bool operator== | ( | read_concern const & | lhs,
|  | read_concern const & | rhs )

friend

Compare equal when all supported fields compare equal.

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

- mongocxx/v1/read_concern.hpp