title: Retrieve an embedded document using Mongoid
body: <p>I have a Mongoid document called Equipment which can embed multiple Question documents. Here are the document schemas:</p>
  
  <pre><code>class Equipment
    include Mongoid::Document
    include Mongoid::Timestamps
  
    field :description
    field :modelNumber
    field :title
    field :categoryId
    field :subCategoryId
    field :stateId
    field :city
    field :askingPrice
  
    embeds_many :questions
  
  end
  
  class Question
    include Mongoid::Document
    field :content
  
    attr_accessible :content
  
    embedded_in :equipment, :inverse_of =&gt; :questions
    embeds_one :answers
  end
  </code></pre>
  
  <p>My issue is that I can retrieve a Question document based on the Question Id. However, my current query returns the parent Equipment document. I would have expected the query to return the embedded Question document. I can eventually get the embedded Question document but I have to loop through all the Question documents of the parent Equipment document. </p>
  
  <p>Here is my current query: </p>
  
  <pre><code>@question = Equipment.where('questions._id' =&gt; Moped::BSON::ObjectId(params[:id])).first
  </code></pre>
  
  <p>Is there a way to directly obtain the embedded Question document?</p>