public static guildData getGuildData(ulong id, bool create = true) { IFindFluent <guildData, guildData> find = findGuildData(id); if (find.CountDocuments() < 1) { if (create) { guildData output = new guildData(id); addGuildData(output); return(output); } else { throw new Exception("Guild data not found"); } } else { return(find.First()); } }
public static void updateGuildData(guildData newData) { IMongoCollection <guildData> guildData = GetOrCreateCollection <guildData>("guildData"); guildData.FindOneAndReplace(c => c.id == newData.id, newData); }
public static void addGuildData(guildData d) { IMongoCollection <guildData> guildData = GetOrCreateCollection <guildData>("guildData"); guildData.InsertOne(d); }