检查 Hasura 中的空数组

Check for empty arrays in Hasura

我有以下查询:

query {
  table1(where: {table2: {id: {}}}) {
    id
  }
}

table1table2 通过外键建立了关系。也就是说,在 table2 中我有一个名为 table1_id 的列,因此我可以从 table1 访问 table2。我想查询 table1 中在 table2 中没有相关行的所有行。也就是说,如果我执行以下查询:

query {
  table1 {
    table2 {
      id
    }
  }
}

我想要 table1 中此查询 returns 中的行是一个空数组。我尝试了以下方法:

query {
  table1(where: {table2: {id: {_in: []}}}) {
    id
  }
}

query {
  table1(where: {table2: {id: {_is_null: true}}}) {
    id
  }
}

但似乎没有任何效果(我得到一个空数组)。我做错了什么?

query {
  table1(where: {_not: { table2: {} } }) {
    id
  }
}

应该处理 return 表 1 中与表 2 没有关系的记录

选择的答案实际上是不正确的。应该是这样的:

query {
  table1(where: {_not: { table2: {} } }) {
    id
  }
}

编辑:现在选择的答案很好:)