title: Mongoid composite query
body: <p>I'm kind of a newbie to mongoid, I have a problem querying the db for inner relations:</p>
  
  <p>this is the first model of whom I wish to create a query</p>
  
  <pre><code>class User
    include Mongoid::Document
    include Mongoid::MultiParameterAttributes
    include Geocoder::Model::Mongoid
  
    has_many :hosted_meals, class_name:'Meal', inverse_of: :host
    has_and_belongs_to_many :followers, class_name: 'User', inverse_of: :following
   .
   .
   .
  end
  </code></pre>
  
  <p>Second model</p>
  
  <pre><code>  class Meal
      include Mongoid::Document
      include Mongoid::Timestamps
      include Geocoder::Model::Mongoid
  
      field :privacy, type: String, default: 'p'
      belongs_to :host, class_name: 'User', inverse_of: :hosted_meals
  </code></pre>
  
  <p>Im trying to create a mongo query that does the following:</p>
  
  <ol>
  <li><p>return all meals of type 'p'</p></li>
  <li><p>return all meals are of type 'f' and their host is in the current user's followers, something like this:</p></li>
  </ol>
  
  <p>Meal.where(:privacy => 'f', :host_id.in => )</p>