title: mongoid: return all embedded documents
body: <p>what is the most efficient way to return all embedded documents?</p>
  
  <p>say a User has many Addresses embedded... in ActiveRecord i could get a count of them with Address.count.  what is the embedded document / mongo version of doing this?</p>
  
  <p>how about when its 2 or more levels deep?  Product > Pressing > Variations... how could i get a count of all the chapters across all books, across all authors?  how would it compare to doing it all in say, Ruby?</p>
  
  <pre><code>Product has_many Pressings
  Pressing has_many Variations
  
  Product
    def self.pressings
      all.collect { |p| p.pressings }.flatten
    end
    def self.variations
      self.pressings.collect { |p| p.variations }.flatten
    end
  end
  </code></pre>