struct MongoCacheTraitsExample {
static constexpr auto kName = "mongo-dynamic-config";
static constexpr auto kMongoCollectionsField =
&storages::mongo::Collections::config;
static constexpr const std::string& kMongoUpdateFieldName =
mongo::db::taxi::config::kUpdated;
using ObjectType = CachedObject;
static constexpr auto kKeyField = &CachedObject::name;
using KeyType = std::string;
using DataType = std::unordered_map<KeyType, ObjectType>;
static constexpr bool kIsSecondaryPreferred = true;
static constexpr auto DeserializeObject = &CachedObject::FromBson;
return doc[
"value"].
As<ObjectType>();
}
static constexpr bool kUseDefaultDeserializeObject = true;
const std::chrono::system_clock::time_point& last_update,
const std::chrono::system_clock::time_point& now,
const std::chrono::system_clock::duration& correction) {
mongo::operations::Find find_op({});
find_op.SetOption(mongo::options::Projection{"key", "value"});
return find_op;
}
static constexpr bool kUseDefaultFindOperation = true;
static constexpr bool kAreInvalidDocumentsSkipped = false;
using MongoCollectionsComponent = components::MongoCollections;
};