title: Spring data mongodb pageable
body: <p>I´m trying to make it works pagination with spring data mongodb, but I found that the first imt eworks, but if I increase the page number in the pagination return me always 0 records.
  Here´s my code:</p>
  
  <p>The code in my Service</p>
  
  <pre><code> @Override
      public List&lt;Purchase&gt; findByUserId(String userId, int pageNumber) {
          Pageable request =
                  new PageRequest(pageNumber - 1, PAGE_SIZE);
          return purchaseRepository.findByUserId(userId, request).getContent();
      }
  </code></pre>
  
  <p>And here the repository</p>
  
  <pre><code>@Component
  public interface PurchaseRepository extends MongoRepository&lt;Purchase, Integer&gt; {
  
      Purchase findById(@Param("id") String id);
  
      Page&lt;Purchase&gt; findByUserId(@Param("userId") String userId,Pageable pageable);
  
      List&lt;Purchase&gt; findAll();
  
  
  }
  </code></pre>
  
  <p>But like I said, when pageNumber is 1 everything is ok. But when is 10 the second time the result is 0
  PAGE_SIZE = 10 and yes, I already check the database and I already have 15 documents.</p>
  
  <p>Any idea fellas?</p>