122 return std::move(_rp);
133 struct deprecated_tag {};
195 return static_cast<read_mode>(_rp.mode());
245 auto const v = _rp.tags();
292 return _rp.max_staleness();
295 BSONCXX_PRIVATE_WARNINGS_PUSH();
296 BSONCXX_PRIVATE_WARNINGS_DISABLE(GNU(
"-Wdeprecated-declarations"));
297 BSONCXX_PRIVATE_WARNINGS_DISABLE(MSVC(4996));
333 if (
auto const opt = _rp.hedge()) {
339 BSONCXX_PRIVATE_WARNINGS_POP();
352 return !(lhs == rhs);
364 return {std::move(v)};
Provides bsoncxx::v_noabi::array::view_or_value.
A polyfill for std::optional<T>.
Definition optional.hpp:799
View const & view() const
Get a View for the type.
Definition view_or_value.hpp:135
read_preference()=default
Constructs a new read_preference with read_mode set to k_primary.
Options related to a MongoDB Read Preference.
Definition read_preference.hpp:49
read_mode
The read preference mode.
Definition read_preference.hpp:62
Describes how MongoDB clients route read operations to the members of a replica set or sharded cluste...
Definition read_preference.hpp:59
read_preference(read_mode mode)
Constructs a new read_preference.
Definition read_preference.hpp:144
read_preference(v1::read_preference rp)
Construct with the mongocxx::v1 equivalent.
Definition read_preference.hpp:111
read_preference & tags(bsoncxx::v_noabi::array::view_or_value tag_set_list)
Sets or updates the tag set list for this read_preference.
Definition read_preference.hpp:229
read_preference(read_mode mode, bsoncxx::v_noabi::document::view_or_value tags)
Constructs a new read_preference with tags.
Definition read_preference.hpp:165
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view > tags() const
Returns the current tag set list for this read_preference.
Definition read_preference.hpp:242
read_preference & mode(read_mode mode)
Sets a new mode for this read_preference.
Definition read_preference.hpp:184
read_preference & max_staleness(std::chrono::seconds max_staleness)
Sets the max staleness setting for this read_preference. Secondary servers with an estimated lag grea...
bsoncxx::v_noabi::stdx::optional< std::chrono::seconds > max_staleness() const
Returns the current max staleness setting for this read_preference.
Definition read_preference.hpp:291
read_mode
Determines which members in a replica set are acceptable to read from.
Definition read_preference.hpp:76
@ k_nearest
Read from the node with the lowest latency irrespective of state.
Definition read_preference.hpp:100
@ k_primary
Only read from a primary node.
Definition read_preference.hpp:80
@ k_secondary_preferred
Prefer to read from secondary nodes.
Definition read_preference.hpp:95
@ k_secondary
Only read from secondary nodes.
Definition read_preference.hpp:90
@ k_primary_preferred
Prefer to read from a primary node.
Definition read_preference.hpp:85
friend bool operator!=(read_preference const &lhs, read_preference const &rhs)
Compares two read_preference objects for (in)-equality.
Definition read_preference.hpp:351
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view > const hedge() const
Gets the current hedge document to be used for the read preference.
Definition read_preference.hpp:331
friend bool operator==(read_preference const &lhs, read_preference const &rhs)
Compares two read_preference objects for (in)-equality.
Definition read_preference.hpp:347
read_preference & hedge(bsoncxx::v_noabi::document::view_or_value hedge)
Sets the hedge document to be used for the read preference. Sharded clusters running MongoDB 4....
Definition read_preference.hpp:319
read_mode mode() const
Returns the current read_mode for this read_preference.
Definition read_preference.hpp:194
read_preference & tags(bsoncxx::v_noabi::document::view_or_value tag_set_list)
Sets or updates the tag set list for this read_preference.
Definition read_preference.hpp:211
read_preference()=default
Constructs a new read_preference with read_mode set to k_primary.
Provides bsoncxx::v_noabi::document::view_or_value.
#define MONGOCXX_DEPRECATED
Declares the associated entity as deprecated.
Definition export.hpp:25
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
The mongocxx v_noabi macro guard postlude header.
The mongocxx v_noabi macro guard prelude header.
v_noabi::view_or_value< view, value > view_or_value
Equivalent to v_noabi::view_or_value<v_noabi::array::view, v_noabi::array::value>.
Definition view_or_value.hpp:31
v_noabi::view_or_value< v_noabi::document::view, v_noabi::document::value > view_or_value
Equivalent to v_noabi::view_or_value<v_noabi::document::view, v_noabi::document::value>.
Definition view_or_value.hpp:30
v1::element::view to_v1(v_noabi::array::element const &v)
Convert to the bsoncxx::v1 equivalent of v.
Definition element.hpp:132
Declares entities whose ABI stability is NOT guaranteed.
v1::bulk_write to_v1(v_noabi::bulk_write v)
Convert to the mongocxx::v1 equivalent of v.
Definition bulk_write.hpp:162
v_noabi::bulk_write from_v1(v1::bulk_write v)
Convert to the mongocxx::v_noabi equivalent of v.
Definition bulk_write.hpp:155
The top-level namespace within which all mongocxx library entities are declared.
Declares mongocxx::v_noabi::search_index_view.
Declares mongocxx::v_noabi::options::transaction.
Provides mongocxx::v_noabi::options::transaction.
Provides mongocxx::v1::read_preference.
Provides bsoncxx::v_noabi::array::view.
Provides bsoncxx::v_noabi::document::view.
Provides std::optional-related polyfills for library API usage.
Declares mongocxx::v_noabi::client.
Declares mongocxx::v_noabi::collection.
Declares mongocxx::v_noabi::database.
Declares mongocxx::v_noabi::events::topology_description.
Declares mongocxx::v_noabi::read_preference.
Declares mongocxx::v_noabi::uri.