I have two collections, let’s call them “parent” and “child”. I want to set up a many-to-many relationship between these two collections and have it be available on both collections.
What I’m having issues with is that last bit - being able to see the related data through either collection.
- If I’m querying the “parent” collection, i would like to be able to include fields from “child” in my GQL.
- Alternatively, if I’m querying “child”, I would like to be able to include fields from “parent”
What happens, though, is this:
- I create a collection called “parent”
- I create a collection called “child”
- I add a M2M field to “parent” called “children” and link it to the child collection. The “parent” collection now has a field to link records from “child” but no field exists on the “child” collection
3a. A pivot-table style collection calledparent_child
has been added to directus that just hasid
,parent_id
, andchild_id
- I attempt to add a field called “parents” to the “child” collection, thinking it will make use of the
parent_child
collection, but when I finish creating that field it makes another collection calledchild_parent
with the exact same fields.
How do I set up the child collection so that the M2M relationship defined in “parent” is settable/usable/queryable/visible/etc?