在java中使用mongodb 的 mongoTemplate,遇到排序问题,所以记录一下
@Override
public List<Form> sortById() {
// TODO Auto-generated method stub
Query query = new Query();
query.with(new Sort(new Order(Direction.DESC,"id")));
List<Form> li = this.mongoTemplate.find(query, Form.class);
return li;
}