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

小程序 文章 2022-01-24 14:20 528 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


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
关于缓存getStorage的问题?
为什么微信搜一搜突然搜不到自己的公众号文章了?之前都可以
Banner广告放在顶部算违规吗?
wx.navigateToMiniProgram 跳转之后 关闭新打开的小程序 可不可以带参数回来?
微信小程序样式使用px兼容性会很差么?
随便看看
现在小程序还可以抓包吗? 514
获取用户信息获取到nickName: "微信用户"? 762
商家券发放 598
小程序发布后的默认首页问题? 586
开通会员卡后,onShow中数据重复问题 511
在webview内嵌的h5页面能唤起原生button按钮对应的getPhoneNumber弹窗吗? 488
从其它页面返回时 image 图片消失 489
企业微信扫码登录,移动端提示登录成功,pc端一直没有跳转页面 893
小程序无法跳转h5页面,部分机型可以,部分不行,开发者工具可以 624
微信小程序版本更新问题? 495