Esempio n. 1
0
        public async Task <IEnumerable <MongoDBPostTest> > SelectSingle()
        {
            //无条件
            var list = await _mongoDbBase.GetIEnumerableAsync <MongoDBPostTest>(e => e.UserId == 1);

            //有条件
            //var list = _context.GetList<MongoDBPostTest>(a => a.Id == "1");

            //得到单条数据,无条件
            //var list = _context.GetSingle<MongoDBPostTest>();

            //得到单条数据,有条件
            //var list = _context.GetSingle<MongoDBPostTest>(a => a.Id == "3");

            //ObjectId internalId = _mongoDbBase.GetInternalId("5bbf41651d3b66668cbb5bfc");

            //var a = _context.GetSingle<MongoDBPostTest>(note => note.Id == "5bbf41651d3b66668cbb5bfc" || note.InternalId == internalId);

            //return ResHelper.Suc(1, list, "成功");
            return(list);
        }
Esempio n. 2
0
 public async Task <IEnumerable <MessageInfo> > GetMessage(string id)
 {
     return(await _mongoDbBase.GetIEnumerableAsync <MessageInfo>(e => e.Id == id));
 }