Spring data mongoRepository Query sort

I don't think it is possible to do it with @Query annotation. If you dont need to paginate you can just make your repository method use Sort parameter:

@Query("{ state:'ACTIVE' }")
Job findOneActive(Sort sort);

and use it:

yourRepository.findOneActive(new Sort(Sort.Direction.DESC, "created"))

Just use sort parameter of @Query annotation. 1 = ASC, -1 = DESC

    @Query(
        value  = ...,
        sort = "{'details.requestTime': -1}"
    )