static void Main(string[] args) { MongoDBHelper mongoDBHelper = new MongoDBHelper(); var list = mongoDBHelper.Get <student>(x => x.Id == 1, 0, 10, "Id"); foreach (var item in list) { Console.WriteLine(item.Name); } //mongoDBHelper.Insert(new student() //{ // Id = 12, // Name = "liubin", // Age = 12 //}); //Console.Write("插入完成"); Console.ReadKey(); }
/// <summary> /// 查询 /// </summary> /// <param name="id"></param> /// <returns></returns> static User Get(string id) { var result = new MongoDBHelper().Get <User>(a => a._id == id); return(result); }