-
代码如下:
exports.main = async () => { const db = uniCloud.database() const res = await db.collection("me").get() console.log("【已拿到me表数据】", res) // bill // // 逾期定义:begin + after_days < today var d0 = new Date() d0.setDate(d0.getDate() - res.data[1].after_days) const d0_iso = d0.toISOString().slice(0, 10) db.collection("bills") .where(`state == 0 && begin < '${d0_iso}'`) .update({ state: 2 }).then(res => { console.log("【账单定时触发成功】", res) }) }
- 发布:2023-08-09 13:02
- 更新:2023-08-09 19:59
- 阅读:160
产品分类: uniCloud/App
示例代码:
操作步骤:
- 见代码
- 见代码
预期结果:
- 【账单定时触发成功】(clientDB的结果,update和get都没问题)
{success: true, header: {…}, result: {…}, requestId: '', errCode: 0}
- 【账单定时触发成功】(clientDB的结果,update和get都没问题)
{success: true, header: {…}, result: {…}, requestId: '', errCode: 0}
实际结果:
Error: 查询参数必须为对象
at Jt.where (/tmp/function/@dcloudio/serverless/lib/aliyun/uni-cloud.js:1:41906)
at Object.exports.main (/tmp/function/__index.js:14:4)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
请求响应状态: fail
Error: 查询参数必须为对象
at Jt.where (/tmp/function/@dcloudio/serverless/lib/aliyun/uni-cloud.js:1:41906)
at Object.exports.main (/tmp/function/__index.js:14:4)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
请求响应状态: fail
bug描述:
同样的代码(唯一差别是clientDB返回值多套了个result),客户端请求成功,放到云函数再调用却失败(只运行到【已拿到me表数据】),报错:查询参数必须为对象,请查明。
h***@qq.com (作者)
焯,要用forjql
2023-08-12 13:13