spring boot--Mongdb排序分页
时间:2021-07-01 10:21:17
帮助过:21人阅读
improt.org.springframework.data.domain.sort包
Criterial critel=new Criterial();
criterl.and("createTime").is(req.getCreateTime())
Sort sort=Sort.by(sort.Diretion.DESC,mongod库对应属性)
//Sort sort = new Sort(Sort.Direction.ASC, “useName”).and(new //Sort(Sort.Direction.ASC, “TIME”));
//多条件userName、time排序
mongoTempalate.find(new Qurey(criteria).with(sort).skip(req.getPage()-1)*req.getPageSize()).limit(req.getpageSize(),对应mongodbJava对象.class,"mongodb集合名称")
spring boot--Mongdb排序分页
标签:gdb and time() size page mongodb spring asc mon