Realm 如何使用GraphQL创建/变异一行,其中一个字段是领域中的引用

Realm 如何使用GraphQL创建/变异一行,其中一个字段是领域中的引用,realm,graphql,Realm,Graphql,我在Realm中创建了以下(测试)集合: RoundType(集合) RoundType中的数据(1行) TestMutate(集合) TestMutate中的数据:还没有 我想在TestMutate中创建一个新行,其中TestMutate中的“roundType”字段是对现有的roundType行的引用 我尝试了以下方法,希望GraphQL知道roundType的存在,但显然这是不对的 mutation { result: addTestMutate(input: {uuid: "ab

我在Realm中创建了以下(测试)集合:

RoundType(集合)

RoundType中的数据(1行)


TestMutate(集合)

TestMutate中的数据:还没有


我想在TestMutate中创建一个新行,其中TestMutate中的“roundType”字段是对现有的roundType行的引用

我尝试了以下方法,希望GraphQL知道roundType的存在,但显然这是不对的

mutation {
  result: addTestMutate(input: {uuid: "abc123", roundType: {id: "234dfg345dfg345"}}) {
        uuid   
  }
}

GraphQL中的正确语法是什么?

很酷,我知道了。只需使用
**update**TestMutate(..)
而不是像这样使用
addTestMutate

mutation {
    updateTestMutate(input: {uuid: "abc123", roundType: {id: "234dfg345dfg345"}}) {
    uuid
  }
}
 uuid (string)
 roundType  (RoundType)
mutation {
  result: addTestMutate(input: {uuid: "abc123", roundType: {id: "234dfg345dfg345"}}) {
        uuid   
  }
}
mutation {
    updateTestMutate(input: {uuid: "abc123", roundType: {id: "234dfg345dfg345"}}) {
    uuid
  }
}