title: spring data mongodb findByIdIn
body: <p>I have the following data model</p>
  
  <pre><code>@Document
  public class FormDocument
  {
      @Id
      private String id;
      private LocalDateTime createTimestamp;
      ...
  }
  </code></pre>
  
  <p>and spring data repository interface</p>
  
  <pre><code>public interface FormRepository extends MongoRepository&lt;FormDocument, String&gt;
  {
      List&lt;FormDocument&gt; findByIdIn(List&lt;String&gt; ids, Pageable pageable);
  }
  </code></pre>
  
  <p>But findByIdIn method returns an empty list even if ids exist in mongodb. I've tested findByXXXIn() for other fields in my document and they all work fine. But when it comes to document id it does not.</p>
  
  <p>This is the first time I'm working with mongodb but I'm familiar with spring data jpa.</p>
  
  <p>I know about </p>
  
  <pre><code>Iterable&lt;T&gt; findAll(Iterable&lt;ID&gt; ids);
  </code></pre>
  
  <p>but I also need to apply paging on the results so it's not helpful in my case.</p>
  
  <p>I tried using @Query (with an in query) and also tried <code>List&lt;ObjectId&gt;</code> instead of <code>List&lt;String&gt;</code> but I wasn't successful.</p>
  
  <p>So what am I missing ?</p>