public static void init() { IMongoCollection <Setting> settings = DbHolder.getDb().GetDatabase(Constants.HUBBL_DB_NAME).GetCollection <Setting>(Constants.SETTINGS_TABLE_NAME); Setting setting = settings.Find(_ => true).First(); serverKey = setting.serverKey; nextPlayerId = setting.nextPlayerId; }
public static void save() { IMongoCollection <Setting> settings = DbHolder.getDb().GetDatabase(Constants.HUBBL_DB_NAME).GetCollection <Setting>(Constants.SETTINGS_TABLE_NAME); settings.FindOneAndUpdate( _ => true, Builders <Setting> .Update.Set(e => e.nextPlayerId, nextPlayerId).Set(e => e.serverKey, serverKey) ); }