我尝试在 AWS AppSync 中使用 GraphQL 查询进行更新突变,但运行查询后无法更新数据。 查询如下:
mutation MyMutation($input: UpdateUserInput!) {
updateUser(input: $input) {
id
email
}
}
查询变量:
{
"input": {
"id": "558505e7-c4fd-4af9-81b1-ac407b324d93",
"email": "[email protected]"
}
}
结果:
{
"data": {
"updateUser": {
"id": "558505e7-c4fd-4af9-81b1-ac407b324d93",
"email": "[email protected]"
}
}
}
有人遇到过同样的问题吗?
对我来说,问题是我安装了版本控制的 DataStore。在这种情况下,为了更新记录,您必须包含当前的_版本号,如下所示:
{
"input": {
"id": "558505e7-c4fd-4af9-81b1-ac407b324d93",
"email": "[email protected]",
"_version" : 4
}
}
中找到了它