Using embeds on a child association to improve performance of sorting?
问题 I have a contact and a lead. They are completely two independent models. I have a leads page where I can query against leads, sort by leads and do other work on leads. Also, a contact can be created without a lead. However, a contact can has_one lead. So I set up my models like so: class Contact include Mongoid::Document has_one :lead field :reference_number field :some_date end class Lead include Mongoid::Document belongs_to :contact field :status end Here is the problem. On the leads page,