分页不适用于 mongo 存储库
Paging not working with mongo repository
我有以下代码来存储评论存储库,并通过它们归因于 post 的 ID 找到它们:
@RepositoryRestResource(path = "/comments")
public interface CommentsRestRepository extends MongoRepository<Comment, String> {
Page<Comment> findByPostID(@Param("postID") String postID, Pageable pageable);
}
使用 URL http://localhost:8080/comments/search/findByPostID?postID=55ff128577c8dc3d6b311da7
时有效。但是,如果我添加 &page=1&size=5
或 page/size/sort 的任何其他组合,它会完全忽略这些参数。为什么是这样?
我使用的是 curl,你必须在 URL 周围使用引号才能计算整个表达式!
我有以下代码来存储评论存储库,并通过它们归因于 post 的 ID 找到它们:
@RepositoryRestResource(path = "/comments")
public interface CommentsRestRepository extends MongoRepository<Comment, String> {
Page<Comment> findByPostID(@Param("postID") String postID, Pageable pageable);
}
使用 URL http://localhost:8080/comments/search/findByPostID?postID=55ff128577c8dc3d6b311da7
时有效。但是,如果我添加 &page=1&size=5
或 page/size/sort 的任何其他组合,它会完全忽略这些参数。为什么是这样?
我使用的是 curl,你必须在 URL 周围使用引号才能计算整个表达式!