Related collections are not returned in GraphQL requests for one-to-many relationship.
I have 2 collections blog
and comment
with the following relationship
blog 1 --> M comment
comment M --> 1 blog
The mapping was created using a field blog_id
in the comment collection. When I query a blog and try to fetch the related comments, I get an error:
Query:
{
blog {
data {
title
comment {
content
}
}
}
}
Error:
"message": "Cannot query field \"content\" on type \"BlogItem\". Did you mean \"comment\"?",
"extensions": {
"category": "graphql"
}
The reverse works. I mean when I query comments and the related blog, it works perfectly. Any idea why?
Note: This is on a local set up using the docker-compose yaml sample provided on their website, which connects to a mysql database
This was a bug in Directus. Fixed by this PR