I have an navigation structure in Directus.io which consists of two collections.
navigations
- id
- title
- navigation_items (One-to-many)
navigation_items
- id
- title
- navigation (Many-to-one)
- parent (Many-to-one)
- children (One-to-many)
Since navigation_items is recursive, how can I get the complete tree in one request?
Example:
$readItem('navigations', id, {
fields: ['id', 'title', 'navigation_items'],
})
Return:
{
"id": "main",
"title": "Main",
"navigation_items": [
3
]
}
But I have three sub levels of navigation items. How can I get the complete tree?!