node.js
学習とパフォーマンスの目的で、今後のプロジェクトにツールを使用することを検討しています。たとえば、Rails のいくつかのモデル:
class User
has_many :topics
has_many :friends
has_many :friend_users, :through => :friends
has_many :friend_topics, :through => :friend_users, :source => :topics
end
class Friend
belongs_to :user
belongs_to :friend_user, :class_name => "User",
:foreign_key => :phone_no, :primary_key => :phone_no
end
class Topic
belongs_to :user
end
次のようなエレガントなクエリ コードを使用できます。
latest_10_topics_from_friends = current_user.friend_topics.limit(10)
最適化された SQL を生成します。node.js
生態系に似たようなものはありますか?