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

[Fix] Query with(pageable) and with(Pageable.unpaged) #4007

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Commits on Mar 25, 2022

  1. [Fix] Query with(pageable) and with(Pageable.unpaged)

    There's a fix proposed when we want to use the same query for the pageable and unpaged instance. A typical case would be 
    
    Get all the Object using the mongoTemplate from the Repository
          mongoTemplate.find(filterQuery.with(pageable), CustomBean.class)
    
    Get the count of all the instance but unpaged
         mongoTemplate.count(filterQuery.with(Pageable.unpaged()), CustomBean.class);
    
    And implementing the page instance
       new PageImpl<>(mongoDocumentsPaged, pageable, count);
    
    In the order of invoking 
      with(pageable) comes first will set the parameters - "skip, limit, sort" and then invoking 
      with(Pageable.unpaged()) won't reset them to "0, 0, Sort.unsorted()" 
    
    The fix will reset 
    
    1) in the with(Pageable pageable)
      
    			this.limit = 0; // default value
    			this.skip = 0; // default value
    
    2) in the with(Sort sort)
       this.sort = sort; // which will be Sort.unsorted()
    Jatish-Khanna committed Mar 25, 2022
    Configuration menu
    Copy the full SHA
    40ce4c0 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #1 from Jatish-Khanna/query-with-unpaged

    [Fix] Query with(pageable) and with(Pageable.unpaged)
    Jatish-Khanna committed Mar 25, 2022
    Configuration menu
    Copy the full SHA
    950d485 View commit details
    Browse the repository at this point in the history

Commits on May 13, 2022

  1. Configuration menu
    Copy the full SHA
    5917580 View commit details
    Browse the repository at this point in the history