title: Why is fetching MongoDB results slow when actual query took only few milliseconds?
body: <p>I'm using Doctrine MongoDB ODM to fetch a small number of documents from a remote MongoDB database.</p>
  
  <p>I confirmed the query took only 1ms to find about 12 matching docs. (i.e. 'millis':1 from explain ouput). But iterating through the results took around 250ms.</p>
  
  <p>I couldn't get any performance gain when I tried combinations of the following options</p>
  
  <ul>
  <li>select('name')</li>
  <li>hydrate(false)</li>
  <li>eagerCursor(true)</li>
  <li>limit(1)</li>
  </ul>
  
  <p>How can I minimize this delay?</p>
  
  <hr>
  
  <p><strong>UPDATE:</strong> More explanation with sample code</p>
  
  <pre class="lang-php prettyprint-override"><code>$qb = $dm-&gt;createQueryBuilder('Books');
  $books = $qb-&gt;select('name')
              -&gt;field('userId')-&gt;equals(123)
              -&gt;field('status')-&gt;equals('active')
              -&gt;eagerCursor(true)  // Fetch all data at once
              -&gt;getQuery()
              -&gt;execute();
  
  /**
   * Due to using Eager Cursor, the database connection should be closed and
   * all data should be in memory now.
   */
  
  // POINT A
  foreach($books as $book) {
      // I do nothing here. Just looping through the results.
  }
  // POINT B.
  
  /**
   * From POINT A to POINT B takes roughly 250ms when the query had 12 matching docs.
   * And this doesn't seem to be affected much by the number of records matched.
   * As the data is already in the memory, I expected this to be done in range of 
   * 5~10ms, not 250ms.
   *
   * Am I misunderstanding the meaning of Eager Cursor?
   */
  </code></pre>