【问题标题】:Directus - Unable to query related (One to Many) collectionDirectus - 无法查询相关(一对多)集合
【发布时间】:2020-03-03 23:02:30
【问题描述】:

在一对多关系的 GraphQL 请求中不返回相关集合。

我有 2 个集合 blogcomment 具有以下关系

blog     1 --> M  comment
comment  M --> 1  blog

映射是使用评论集合中的字段blog_id 创建的。当我查询博客并尝试获取相关的 cmets 时,出现错误:

查询:

{
    blog {
        data {
            title
            comment {
                content
            }
        }
    }
}

错误:

"message": "Cannot query field \"content\" on type \"BlogItem\". Did you mean \"comment\"?",
"extensions": {
   "category": "graphql"
}

反之亦然。我的意思是当我查询 cmets 和相关博客时,它运行良好。知道为什么吗?

注意:这是使用他们网站上提供的 docker-compose yaml 示例在本地设置的,该示例连接到 mysql 数据库

【问题讨论】:

    标签: directus


    【解决方案1】:

    这是 Directus 中的一个错误。由this PR修复

    【讨论】:

      猜你喜欢
      • 2015-12-06
      • 2019-01-04
      • 2011-02-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-22
      • 1970-01-01
      相关资源
      最近更新 更多