【发布时间】:2021-09-25 05:09:50
【问题描述】:
我已将以下 GraphQL 架构上传到我的 FaunaDB:
type RSheet @collection(name: "sheets") {
columns: [RColumn!]! @relation
sections: [RSection]!
}
type RColumn @collection(name: "columns") {
label: String!
sheet: RSheet!
}
type RSection @embedded {
label: String
items: [[RItem!]]!
}
type RItem @embedded {
value: String
form: RItemForm
column: RColumn!
}
enum RItemForm {
STRING
}
这是一张包含列和多个部分的工作表,其中包含构成表格行的项目。
现在,我创建了一个工作表和两列。
“表格”数据库中的集合
{
"ref": Ref(Collection("sheets"), "304268724760740364"),
"sections": [
{
"label": null,
"items": []
}
]
}
“列”数据库中的集合
{
"ref": Ref(Collection("columns"), "304268724764934668"),
"label": "Begin",
"sheet": Ref(Collection("sheets"), "304268724760740364")
},
{
"ref": Ref(Collection("columns"), "304268724776469004"),
"label": "End",
"sheet": Ref(Collection("sheets"), "304268724760740364")
}
到目前为止,这一切都很好。我可以创建工作表和/或列、更新和删除它们。
但是,如果我想使用 FaunaDB 的 GraphQL 添加部分项目,我不能 connect 项目的列。我收到一条错误消息,指出我必须提供该列的 ID!:
当我这样做时,只会将 ID 写入数据库,并且不会创建连接 Ref(…):
“表格”数据库中的集合
{
"ref": Ref(Collection("sheets"), "304268724760740364"),
"sections": [
label: null
{
"items": [
[
{
"value": "Item 1",
"column": "304268724791149068" /// EXPECTED: Ref(Collection("columns"), "304268724791149068")
}
]
]
}
]
}
我错过了什么?
【问题讨论】: