#include <mongocxx/v1/read_preference.hpp>
Options related to a MongoDB Read Preference.
Supported fields include:
- See also
-
- Attention
- This feature is experimental! It is not ready for use!
◆ read_mode
The read preference mode.
- See also
-
- Attention
- This feature is experimental! It is not ready for use!
| Enumerator |
|---|
| k_primary | Primary member only (default).
|
| k_primary_preferred | Primary member when available, secondary otherwise.
|
| k_secondary | Secondary members only.
|
| k_secondary_preferred | Secondary members when available, primary otherwise.
|
| k_nearest | A random eligible member based on a specified latency threshold.
|
◆ ~read_preference()
| mongocxx::v1::read_preference::~read_preference |
( |
| ) |
|
◆ read_preference() [1/3]
| mongocxx::v1::read_preference::read_preference |
( |
read_preference && | other | ) |
|
|
noexcept |
Move constructor.
- Postconditions:
- other is in an assign-or-destroy-only state.
◆ read_preference() [2/3]
| mongocxx::v1::read_preference::read_preference |
( |
read_preference const & | other | ) |
|
◆ read_preference() [3/3]
| mongocxx::v1::read_preference::read_preference |
( |
| ) |
|
Default initialization.
- Postconditions:
- All supported fields are "unset" or zero-initialized.
◆ hedge() [1/2]
Return the current "hedge" field.
- Deprecated
- Deprecated in MongoDB Server version 8.0.
◆ hedge() [2/2]
Set the "hedge" field.
- Deprecated
- Deprecated in MongoDB Server version 8.0.
◆ max_staleness() [1/2]
Return the current "maxStalenessSeconds" field.
- Returns
- An empty optional if the option is unset.
◆ max_staleness() [2/2]
| read_preference & mongocxx::v1::read_preference::max_staleness |
( |
std::chrono::seconds | v | ) |
|
Set the "maxStalenessSeconds" field.
- Parameters
-
| v | -1 is equivalent to "unset". |
◆ mode() [1/2]
| read_mode mongocxx::v1::read_preference::mode |
( |
| ) |
const |
Return the current "mode" field.
◆ mode() [2/2]
Set the "mode" field.
- Parameters
-
- See also
-
◆ operator=() [1/2]
Move assignment.
- Postconditions:
- other is in an assign-or-destroy-only state.
◆ operator=() [2/2]
◆ tags() [1/3]
Return the current "tag_sets" field.
◆ tags() [2/3]
Set the "tag_sets" field.
◆ tags() [3/3]
Set the "tag_sets" field.
◆ operator!=
Compare equal when all supported fields compare equal.
◆ operator==
Compare equal when all supported fields compare equal.
The documentation for this class was generated from the following file: