You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The has_many relationship type will find many entities of RemoteType where RemoteType[RelationshipKey] === LocalType[RelationshipKey]. This implicitly forces a one to many / many to one relationship - any RemoteType may relate to one and only one LocalType. To implement Many to Many relationships, developers must introduce an implicit helper entity.
With the addition of list properties in f2edc, we can implement a Many to Many type by putting a list of RemoteType[RelationshipKey] in LocalType[RelationshipKey: <List>. For a practical example, this would mean creating Blog::tags as a many to many relationship, and a Blog::tag_id as a List property to maintain the list of Tag ids.
We have two entities, Foo and Bar. Foo will have many Bars, via foo.bars, with the list of bar_ids in Foo::bar_ids. The question is how to declare this, in the relationship "type". I see three options: has_list and many_many, both introducing new type options. The third option is a bit more compact, but uses non-local information: has_many, and when the local property is type: "list" use the many/many logic.
Introduce new type, and call it has_list or has_many, or override an existing type?
The text was updated successfully, but these errors were encountered:
The
has_many
relationship type will find many entities ofRemoteType
whereRemoteType[RelationshipKey] === LocalType[RelationshipKey]
. This implicitly forces a one to many / many to one relationship - any RemoteType may relate to one and only one LocalType. To implement Many to Many relationships, developers must introduce an implicit helper entity.With the addition of list properties in f2edc, we can implement a Many to Many type by putting a list of
RemoteType[RelationshipKey]
inLocalType[RelationshipKey: <List>
. For a practical example, this would mean creatingBlog::tags
as a many to many relationship, and aBlog::tag_id
as a List property to maintain the list of Tag ids.How do we represent this?
Overall Structure
We have two entities, Foo and Bar. Foo will have many Bars, via
foo.bars
, with the list ofbar_id
s inFoo::bar_ids
. The question is how to declare this, in the relationship"type"
. I see three options:has_list
andmany_many
, both introducing newtype
options. The third option is a bit more compact, but uses non-local information:has_many
, and when the localproperty
istype: "list"
use the many/many logic.Introduce new type, and call it
has_list
orhas_many
, or override an existing type?The text was updated successfully, but these errors were encountered: