我想用spring将orderby添加到mongodb中的以下存储库方法中。我尝试了各种方法,但没有奏效
public interface StageRepository extends MongoRepository<Stage, String> {
@Query("{$and: [ { 'categoryId': { $eq: ?0 } }, { 'isDeleted': { $eq: ?1 } } ]}")
public List<Stage> findByCategoryIdAndIsNotDeleted(String categoryId, Boolean deleted);
}
我想在查询中添加 orderby 'order'。
不知道该怎么做。