我正在尝试使用GraphQL在Neo4j中创建to节点之间的关系。突变应该是什么样子的?
模式显示它应该如下所示。
AddPersonRoll(
from: _PersonInput!
to: _RollInput!
): _AddPersonRollPayload我试过
mutation {
AddPersonRoll(
from: {
id: "be91aaca-944d-49f7-b3fd-c89ad454d5ab"
}
to: {
id: "8726255f-b6b6-4299-ba01-95f6d4ef2be7"
}
) {
from {
id
name
}
to {
id
name
}
}
}而且它起作用了。但是,当我尝试将var放入查询中时,我得到了
{
"error": "Failed to execute 'fetch' on 'Window': Invalid name"
}代码是
mutation AddPersonRoll($PersonInput: ID!, $RollInput: ID!){
AddPersonRoll(
from: {
id: $PersonInput
}
to: {
id: $RollInput
}
) {
from {
id
name
}
to {
id
name
}
}
}
{
"PersonInput": "3cc70aca-9e07-4bbd-acb2-92670b4d1b0d",
"RollInput": "8726255f-b6b6-4299-ba01-95f6d4ef2be7"
}发布于 2020-07-14 14:34:38
今天早些时候我遇到类似的问题时发现了这个。这是我的工作变异:
const ADD_INCIDENT_USER = gql`
mutation AddIncidentUser($from: ID!, $to: ID!) {
AddIncidentUser(from: { id: $from }, to: { id: $to }) {
from {
id
}
to {
id
}
}
}
`;因此,在您的示例中,您可能希望更改
mutation AddPersonRoll($PersonInput: ID!, $RollInput: ID!){至
mutation AddPersonRoll($from: ID!, $to: ID!){https://stackoverflow.com/questions/56616121
复制相似问题