Closed
Description
I was trying to call the method findAll(Pageable pageable)
on a MongoRepository instance with the following pageable: Pageable.unpaged(sort)
When looking at the data i saw that the sort order was ignored completely.
After digging through the sources I think the issues lies in Query.java
public Query with(Pageable pageable) {
if (pageable.isUnpaged()) {
return this; // <--- Here the sort is being ignored
}
this.limit = pageable.toLimit();
this.skip = pageable.getOffset();
return with(pageable.getSort());
}
As a work around i use PageRequest.of(0, Integer.MAX_VALUE, sort)
but would be nice if this could be changed as it's not something you would expect