mongodb.core.query.Criteria 查询非空|ne和排序|sort

mongodb.core.query.Criteria 查询非空|ne和排序|sort

尝试吧:

query.addCriteria(Criteria.where("modelId").ne("").ne(null));query.with(new Sort(new Order(Direction.DESC, "ct")));


多个字段排序:第一排序按照sort降序,第二排序按照ct降序

query.with(new Sort(new Order(Direction.DESC, "sort")).and(new Sort(Direction.DESC,"ct")));

推荐阅读