1

我有具有以下数据模型的类别

类型类别{
  身份证:身份证!@ID
  名称:字符串!
  parentId:类别@relation(链接:INLINE)
}

在这个我想运行查询,我可以在其中 parentId 等于 null 的类别数组。

每当我尝试运行查询时,我都会得到所有字段,包括不为空的字段。

4

1 回答 1

0

这应该满足您的需求:

query {
  categories(where: {  parentId: null }) {
    name
  }
}

对于非空的:

query {
  categories(where: {  NOT:[{parentId: null }]}) {
    name
  }
}

于 2019-01-22T19:56:57.850 回答