Spring-data-MongoDB sort

  mongodb, question

Using the Spring-data-MongoDB framework, sorting during query, I saw on the Internet that some people write new Query().sort.on, but the version 1.3.1 I use does not have this method, and I don’t know how to sort. Please also ask Daniel who knows about it to give you some advice.

Direction direction=true?  Direction.ASC:Direction.DESC;
 query.with(new Sort(direction,key));