如何在graphql中更新数组中的值

  • 本文关键字:数组 更新 graphql graphql
  • 更新时间 :
  • 英文 :


我有这样的结构:

"data": {
"item": {
"id": "1",
"options": [
{
"label": "Top",
"specs": [
{
"label": "Left",
"value": "0"
},
{
"label": "Right",
"value": "1000"
}
]
},
{
"label": "Bottom",
"specs": [
{
"label": "Left",
"value": "11"
},
{
"label": "Right",
"value": "1"
}
]
}
]
}
}
}

并尝试更新:item ->options (label 'Top') ->specs (label 'Right') ->价值。

我应该写什么查询来访问这些数组中的值?

GraphQL查询不是双向的。如果你想改变数据,你必须使用mutations.

我建议阅读说明书

GraphQL规格

最新更新