Loopback Relation - hide second list?

If adding a has many relation which points to itself, the result is 2 lists.

For example:
A Feature is related to other Featues (many to many).

If you add this, you will get 2 relations and boths are displayed in the feature. In that special case it makes no sense to show the other way around as well. But it depends on the role. e.g.

  • ïs related’ works in both directions
  • “is parent” / “is child” may require an own list.

If it would be possible to design the layout of pages and simply hide the second relation, it would help.

I don’t think you should select many-to-many in this case, one-to-many will be enough if you want to just have a hierarchy. In this case you will have one list.

I will give it a try and see if it works.

I suppose that there are times when it’s useful to have a ‘peer’ relationship (i.e. not directional) allowing for entities of the same type can be put in a group together. In this case, only one field is needed.

But I think the next question might be, “What is the meaning of the grouping?” and if it is because different groups of entities have different characteristics, then perhaps this ought to be solved using either:

  • single- or multi-select fields (a.k.a ‘tags’)
  • many-to-one or many-to-many relationship to another type (i.e. the ‘peer group’ type)

and then creating views to show entities grouped according to tags/groups

For the last option, the many-to-many relationship would actually show as a collection in the entity view and it would be possible to see all peers (by enabling the display of the corresponding field for the peer group collection).
For the other options, we might need to wait until this has been implemented to directly see peers in the entity view.

Maybe I’m missing something but it seems no matter what kind of relationship I create to “self”, I always end up with two fields. Either one single-select and a multi, two multis, or two singles. Why? Maybe I don’t understand the logic of “relationship” quite well enough and what it means technically. But to my mind a relationship to self is a bi-directional thing. I select 1 (or more) related entities in one entity and on that other entity it shows the same relationships. They can be edited in either place. But you only need one field (I think) to define and display this. So why are there always two? And can this be fixed?

1 Like

I think there are use-cases for both - but I guess this is the same issue as Basic Relation between the same Type