云函数操作数据库删除总是报错?

小程序 文章 2022-01-24 14:20 400 0 全屏看文

AI助手支持GPT4.0

云函数操作数据库删除总是报错?Cloud function operation database deletion always reports an error?

云函数操作数据库删除总是报错?

这是云函数runDB.js中的remove()代码:

这是外部的index.js调用云函数runDB中删除数据库中记录的代码:

运行后,微信开发者一直报这个错误(collection remove fail, param query cannot be empty):

已经仔细检查了N遍,所有参数都是准确的!

报错提示是 查询参数不能为空,我写了查询条件了啊!{submitDate: _.neq(getDate())},

难道是云函数不能识别_.neq()这样的数据库查询比较操作符?怎么能让该查询条件通过识别呢?

我这个云函数runDB操作数据库增、改、查都成功运行,唯独这个删除总是报查询参数为空的错误!感觉还是和_.neq()有关系!


This is the cloud function rundb JS: This is the external index JS calls the cloud function rundb to delete the code recorded in the database: after running, the wechat developer keeps reporting this error (collection remove fail, param query cannot be empty): it has been carefully checked n times and all parameters are accurate! The error message is that the query parameters cannot be empty. I wrote the query criteria! {submitdate:. NEQ (getdate())}, is it because the cloud function can't recognize Database query comparison operators such as neq()? How can this query condition be recognized? My cloud function rundb successfully added, modified and queried the database, but the deletion always reports the error that the query parameter is empty! It still feels like NEQ () has something to do with it!

回答:

困难:

_是要自己定义的,有在云函数里定义下划线是command吗?getDate是什么?打印一下condition,看看接收的是什么?


风中里:在云函数里已经定义了command,看下图。getDate是获取年月日的函数,返回字符串。
Mr.Zhao:

在云函数里面拼接条件,db.command传不过去

老张:

“_”不支持透传过去,需要在云函数里重新赋值。

-EOF-

AI助手支持GPT4.0