Esempio n. 1
0
        public void UpdateLocationCases(LocationObject lo, AreaInfo ai, CaseInfo ci)
        {
            var collection = db.GetCollection <AreaInfo>("Areas");

            Console.WriteLine(lo.locName + " UPDATED");

            collection.FindOneAndUpdate(c => c.areaName == ai.areaName && c.locationsList.Any(s => s.locName == lo.locName),
                                        Builders <AreaInfo> .Update.Push(c => c.locationsList[-1].casesList, ci));
        }
Esempio n. 2
0
        public void AppendRecord <T>(string table, string id, LocationObject ld)
        {
            var collection = db.GetCollection <T>(table);

            var filter = Builders <T> .Filter.Eq("areaName", id);

            var update = Builders <T> .Update.Push("locationsList", ld);

            var result = collection.UpdateOne(filter, update);
        }