Mongoid Relationships

时间:2019-04-30 11:27:58   收藏:0   阅读:133

1:1 embedded relationship: 

技术分享图片

 

M:1 linked relationship(one_direction): 

child uses belongs_to 

parent uses has_many 

 

1:M embedded relationship: 

技术分享图片

 

M:1 embedded relationship:

 

技术分享图片

 

技术分享图片

*annotated link 

*"1" side has a primary key and typically has no reference to the child within the document 

*"M" side will typically host the foreign key

 

1:1 Linked relationship - has_one:

child belongs_to 

parents has_one 

 

M:M Linked Relationship 

has_and_belongs_to_many 

技术分享图片

 

原文:https://www.cnblogs.com/vixennn/p/10794826.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!