title: How could I manipulate HasMany relationship with difference of foreign key and primary key
body: <p>I have <code>User model and Comment model</code>, each user has many comments</p>
  
  <p>To look up the owner of a comment, you need to  Find the user uid which matchs the author_id of the comment.</p>
  
  <p>How could  I set the has_many relation in Mongoid?</p>
  
  <p>Is it possible to avoid <code>N+1 query</code>, when I loaded all comments first then add the user.name for each comment? Thanks</p>
  
  <pre><code>class Comment
    include Mongoid::Document
    include Mongoid::Timestamps
    belongs_to :user #, foreign_key: :uid ????
    field :post_id, type: String
    field :author_id, type: Integer
  end
  
  
  class User
    include Mongoid::Document
    include Mongoid::Timestamps
    has_many :comments
    field :uid, type: Integer
    field :name, type: String
  end
  </code></pre>