Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoRepository.findAll(Pageable) ignores Sort when using unpaged Pageable #4771

Closed
Dekay21 opened this issue Aug 16, 2024 · 0 comments
Closed
Assignees
Labels
type: bug A general bug

Comments

@Dekay21
Copy link

Dekay21 commented Aug 16, 2024

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

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 16, 2024
@mp911de mp911de added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 12, 2024
@mp911de mp911de changed the title Mongorepository findAll(Pageable pageable) ignores Sort when using unpaged Pageable MongoRepository.findAll(Pageable) ignores Sort when using unpaged Pageable Sep 12, 2024
mp911de pushed a commit that referenced this issue Sep 12, 2024
mp911de added a commit that referenced this issue Sep 12, 2024
Apply sort of unpaged Pageable to QuerydslMongoPredicateExecutor query.

Original pull request: #4773
Closes #4771
mp911de pushed a commit that referenced this issue Sep 12, 2024
mp911de added a commit that referenced this issue Sep 12, 2024
Apply sort of unpaged Pageable to QuerydslMongoPredicateExecutor query.

Original pull request: #4773
Closes #4771
mp911de added a commit that referenced this issue Sep 12, 2024
Apply sort of unpaged Pageable to QuerydslMongoPredicateExecutor query.

Original pull request: #4773
Closes #4771
@mp911de mp911de added this to the 4.2.10 (2023.1.10) milestone Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants