问题描述
我能够像这样获得 username
:
query {
allUsers {
edges {
node {
username
}
}
}
}
但是当我像这样为 xxx
节点尝试相同的方法时:
query {
allUsers {
edges {
node {
xxx
}
}
}
}
它说:
“NoteObjectConnection”类型的字段“xxx”必须有一个子 选择。
如何读取xxx
节点中的数据?
解决方法
在 GraphQL 中,每个字段都必须解析为具体数据(如 Int
、Float
、String
等)。错误很简单;您需要选择 xxx
上的字段:
query {
allUsers {
edges {
node {
xxx {
other
fields
needed
}
}
}
}
}