【发布时间】:2019-03-24 13:13:48
【问题描述】:
我正在研究 GraphQL 突变,在这里需要帮助。我的文档看起来像
{
"_id" : ObjectId("5bc02db357146d0c385d4988"),
"item_type" : "CategoryMapping",
"id" : null,
"CategoryGroupName" : "Mystries & Thriller",
"CustomCategory" : [
{
"name" : "Private Investigator",
"MappedBisacs" : [
"investigator",
"Privately owned",
"Secret"
]
},
{
"name" : "Crime Investigator",
"MappedBisacs" : [
"crime investigator",
"crime thriller"
]
}
]
}
用户界面
- 允许用户通过复选框列表更新 MappedBisac。因此用户可以添加/更新或删除 bisacs 列表。
问题 - 当客户端发送如下 GraphQL 查询时;
mutation {
CategoryMapping_add(input: {CategoryGroupName: "Mystries & Thriller", CustomCategory: [{name: "Crime Investigator", MappedBisacs: ["investigator", "dafdfdaf", "dafsdf"]}]}) {
clientMutationId
}
}
我需要找到特定的自定义类别并更新其 bisac 数组。
【问题讨论】: