title: Rails Mongoid search with many-to-many where clause
body: <p>I have "Vaga":</p>
  
  <p><strong>vaga.rb</strong></p>
  
  <pre><code>class Vaga
    include Mongoid::Document
  
    has_and_belongs_to_many :areas, autosave: true
  </code></pre>
  
  <p>As a result:</p>
  
  <pre><code>#&lt;Vaga _id: 5524940d706f6c09180c0000, area_ids: [BSON::ObjectId('5524939b706f6c09180b0000'), BSON::ObjectId('5436721b706f6c0918cf0000')], titulo: "Ruby on Rails developer"&gt;
  </code></pre>
  
  <p>And "Area"
  <strong>area.rb</strong></p>
  
  <pre><code>class Area
    include Mongoid::Document
  
    has_and_belongs_to_many :vagas
  </code></pre>
  
  <p>How can I get all the "vagas" with an array of "areas"?</p>
  
  <p>I'm trying this:</p>
  
  <pre><code>vagas = Vaga.all('areas.id' =&gt; '5524939b706f6c09180b0000')
  </code></pre>
  
  <p>But it won't work</p>