Exemple #1
0
        public static async Task mainAsync()
        {
            var db = new MongoClient().GetDatabase("school");
            var collection = db.GetCollection<BsonDocument>("students");
            var list = await collection.Find(new BsonDocument()).ToListAsync();
            var newList = new List<BsonDocument>();

            list.ForEach(data => newList.Add(dropScore(data)));

            await db.DropCollectionAsync("students");
            await db.CreateCollectionAsync("students");
            await collection.InsertManyAsync(newList);
        }