Example #1
0
        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());
            }
        }
Example #2
0
        public static void updateGuildData(guildData newData)
        {
            IMongoCollection <guildData> guildData = GetOrCreateCollection <guildData>("guildData");

            guildData.FindOneAndReplace(c => c.id == newData.id, newData);
        }
Example #3
0
        public static void addGuildData(guildData d)
        {
            IMongoCollection <guildData> guildData = GetOrCreateCollection <guildData>("guildData");

            guildData.InsertOne(d);
        }