我试图描述与包含额外信息字段的链接表的 1:NM:1 关系。table1 和 table3 都有很多字段。
现有表如下所示:
Table1 1:N Table2 M:1 Table3
somethings extra info otherthings
id table1_id id
table3_id
table2.extra 信息让我搞砸了。我如何用 mongoid 来描述这个?
class Model1
include Mongoid::Document
field :somethings, :type => String
has_many_and_belongs_to :inbetween
end
class ModelInbetween
include Mongoid::Document
field :extra_info, :type => String
???
end
class Model2
include Mongoid::Document
field :otherthings, :type => String
has_many_and_belongs_to :inbetween
end