title: $in operator performance in MongodDB
body: <p>Is it slow to use the <code>$in</code> operator in MongoDB with a large array of data (more than 5 millions entries)?</p>
  
  <pre><code>posts.find({
      id: {
          $in : ['id1','id2'] 
      }
  })
  </code></pre>
  
  <p>In Java:</p>
  
  <pre><code>Page&lt;PostsEntity&gt; postsEntities = postsRepository.findByIdIn(ids, new PageRequest(i, PAGE_SIZE));
  </code></pre>
  
  <p>My <code>id</code> is a String and it is indexed, but the query takes way too much time. </p>
  
  <p>Are <code>$in</code> queries not recommended for large-sized datasets?</p>