title: Rails 'first' method running extra queries on Mongoid
body: <p>I am using Mongoid as the db for my Rails app.
  Noticing too many QUERY lines in the log I decided to take a look.</p>
  
  <p>Part of the code reads:</p>
  
  <pre><code>&lt;%= if movie.directors.first
  ... Do something ...                  
  end %&gt;
  </code></pre>
  
  <p>For this the log showed two queries</p>
  
  <pre><code> MOPED: 127.0.0.1:27017 QUERY        database=tgmd-wiki collection=directors selector={"$query"=&gt;{"$and"=&gt;[{"_id"=&gt;{"$in"=&gt;["510a097b53c205c294000163"]}}]}, "$orderby"=&gt;{:_id=&gt;1}} flags=[:slave_ok] limit=-1 skip=0 batch_size=nil fields=nil (0.7060ms)
    MOPED: 127.0.0.1:27017 QUERY        database=tgmd-wiki collection=directors selector={"$query"=&gt;{"$and"=&gt;[{"_id"=&gt;{"$in"=&gt;["510a097b53c205c294000163"]}}]}, "$orderby"=&gt;{:_id=&gt;1}} flags=[:slave_ok] limit=-1 skip=0 batch_size=nil fields=nil (0.4706ms)
  </code></pre>
  
  <p>When I changed that to read:</p>
  
  <pre><code>&lt;%= if movie.directors[0]
  ... Do something ...                  
  end %&gt;
  </code></pre>
  
  <p>there was only one query.</p>
  
  <pre><code>MOPED: 127.0.0.1:27017 QUERY        database=tgmd-wiki collection=directors selector={"$and"=&gt;[{"_id"=&gt;{"$in"=&gt;["510a097b53c205c294000163"]}}]} flags=[:slave_ok] limit=0 skip=0 batch_size=nil fields=nil (0.7353ms)
  </code></pre>
  
  <p>Why is the <strong>first</strong> method doing a re-query at all?
  Overlooking this as just a 0.4 ms difference isn't possible because
  there are lot of such queries in my code.</p>
  
  <p>Any insights?</p>