9#include <initializer_list>
16#include <userver/formats/bson/bson_builder.hpp>
17#include <userver/formats/bson/document.hpp>
18#include <userver/formats/bson/value.hpp>
20USERVER_NAMESPACE_BEGIN
42 explicit ReadPreference(
Mode mode);
43 ReadPreference(
Mode mode, std::vector<formats::bson::Document> tags);
46 std::optional<std::chrono::seconds> GetMaxStaleness()
const;
47 const std::vector<formats::bson::Document>& GetTags()
const;
59 std::optional<std::chrono::seconds> max_staleness_;
60 std::vector<formats::bson::Document> tags_;
99 bool IsMajority()
const;
100 size_t NodesCount()
const;
101 const std::string& Tag()
const;
102 std::optional<
bool> Journal()
const;
103 const std::chrono::milliseconds& Timeout()
const;
114 std::optional<
bool> journal_;
116 std::chrono::milliseconds timeout_;
134 explicit Skip(size_t value) : value_(value) {}
136 size_t Value()
const {
return value_; }
145 explicit Limit(size_t value) : value_(value) {}
147 size_t Value()
const {
return value_; }
163 Projection(std::initializer_list<std::string_view> fields_to_include);
193 const bson_t* GetProjectionBson()
const;
197 formats::
bson::impl::BsonBuilder projection_builder_;
215 Sort&
By(std::string_view field, Direction direction);
219 const bson_t* GetSortBson()
const;
223 formats::
bson::impl::BsonBuilder sort_builder_;
231 explicit Hint(std::string index_name);
238 const formats::
bson::
Value& Value()
const;
255 const formats::
bson::
Value& Value()
const;
280 explicit Comment(std::string);
282 const std::string& Value()
const;
292 explicit MaxServerTime(
const std::chrono::milliseconds& value) : value_(value) {}
294 const std::chrono::milliseconds& Value()
const {
return value_; }
297 std::chrono::milliseconds value_;