title: What is ActiveRecord equivalence in the node.js world?
body: <p>I am considering to use <code>node.js</code> tools for a upcoming project, for learning and performance purpose. <a href="https://stackoverflow.com/questions/11151243/how-to-optimize-this-query-in-activerecord-latest-10-topics-by-friends">For example</a>, some models in Rails:</p>
  
  <pre><code>class User
    has_many :topics
    has_many :friends
    has_many :friend_users, :through =&gt; :friends
    has_many :friend_topics, :through =&gt; :friend_users, :source =&gt; :topics      
  end
  
  class Friend
    belongs_to :user
    belongs_to :friend_user, :class_name =&gt; "User", 
        :foreign_key =&gt; :phone_no, :primary_key  =&gt; :phone_no
  end
  
  class Topic
    belongs_to :user
  end
  </code></pre>
  
  <p>allows elegant query code like:</p>
  
  <pre><code>latest_10_topics_from_friends = current_user.friend_topics.limit(10)
  </code></pre>
  
  <p>and generates optimized SQLs. Is there something similar in <code>node.js</code> ecosystem?</p>