MongoDB C#驱动给内嵌list添加数据

         Fc fc = new Fc() {};
            var temp = Builders<MModel>.Filter.Where(m=>m.id== "882d4d22-ff70-41f9-beae-ccc358fd9d7d");
            var filter = Builders<Model>.Filter.Eq("_id", id);
            var document = collection.Find(filter).FirstAsync().Result;
            var update = Builders<Model>.Update.Push("contents.phon", fc);
            var result = collection.UpdateOneAsync(filter, update).Result;

 

posted @ 2017-10-18 10:54  向萧  阅读(1160)  评论(0编辑  收藏  举报