我正在学习 FQL 并尝试进行大规模更新,但我无法弄清楚我做错了什么,也无法真正弄清楚错误的真正指向。
这是我的代码:
const updateResult = await serverClient.query(
q.Map(
guests,
q.Lambda(
"guest",
q.Update(q.Var("guest").id, {
data: {
emailSent: q.Var("guest").emailSent,
emailStatus: q.Var("guest").emailStatus,
emailRejectReason: q.Var("guest").emailRejectReason,
},
})
)
)
);
这是 guest 对象通过 console.log 得到的:
[ { email: 'myemail+bart72320@gmail.com',
emailStatus: 'sent',
emailRejectReason: null,
emailSent: true,
id: Ref(Collection("Guests"), "271884343706649107") } ]
这是与 JSON.stringify 相同的对象:
[
{
"email": "myemail+bart72320@gmail.com",
"emailStatus": "sent",
"emailRejectReason": null,
"emailSent": true,
"id": {
"@ref": {
"id": "271884343706649107",
"collection": {
"@ref": {
"id": "Guests",
"collection": {
"@ref": {
"id": "collections"
}
}
}
}
}
}
}
]
这是返回的错误的一部分:
{ [BadRequest: invalid expression]
name: 'BadRequest',
message: 'invalid expression',
description:
'No form/function found, or invalid argument keys: { params }.',
requestResult:
RequestResult {
method: 'POST',
path: '',
query: null,
requestRaw:
'{"map":{"lambda":"guest","expr":{"params":{"object":{"data":{"object":{}}}}}},"collection":[{"object":{"email":"myemail+bart72320@gmail.com","emailStatus":"sent","emailRejectReason":null,"emailSent":true,"id":{"@ref":{"id":"271884343706649107","collection":{"@ref":{"id":"Guests","collection":{"@ref":{"id":"collections"}}}}}}}}]}',
requestContent: Expr { raw: [Object] },
responseRaw:
'{"errors":[{"position":["map","expr"],"code":"invalid expression","description":"No form/function found, or invalid argument keys: { params }."}]}',
我已经得到了工作的更新和 lambdas 的工作,但不是这个,也许我只是不擅长阅读非常嵌套的、功能性的错误消息。什么是表单,它与函数相同,还是我缺少键:参数?我不知道该怎么做。
请帮助我了解我做错了什么以及此错误消息是否真的有用以及如何解释它,或者它只是一个令人困惑的包罗万象?
谢谢!