// 云函数入口文件 const cloud = require( 'wx-server-sdk' ) cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) const db = cloud.database() // 云函数入口函数 exports.main = async (event, context) => { const wxContext = cloud.getWXContext(); return await onAggr_All(event); } async function onAggr_All(event) { const _ = db.command return await db.collection( 'garbege' ).where({ gar_cls: _.all([ '1' , '2' ]) }).get() } |
下面是调用的返回内容:
Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 790098a8-de9c-11e9-b869-525400697544, cloud function service error code -504002, error message _. all is not a function; at cloud.callFunction api; at new u (WAService.js:1) at d (WAService.js:1) at f (WAService.js:1) at Function.success (WAService.js:1) at WAService.js:1 at C (WAService.js:1) at i.<anonymous> (WAService.js:1) at i.emit (WAService.js:1) at Rs (WAService.js:1) at WAService.js:1 |
调用日志是这样的:
日志内容 Request ID: 790098a8-de9c-11e9-b869-525400697544 执行时间: 2.49ms内存使用: 35.58 MB 返回结果 { "errorCode" :1, "errorMessage" : "user code exception caught" , "stackTrace" : "_.all is not a function" } 日志 START RequestId: 790098a8-de9c-11e9-b869-525400697544 Event RequestId: 790098a8-de9c-11e9-b869-525400697544 TypeError: _. all is not a function at onAggr_All (/var/user/index.js:65:16) at EventHandler.exports.main [as realHandler] (/var/user/index.js:42:22) at EventHandler.handle (/var/runtime/node8/bootstrap.js:324:28) at invoke (/var/runtime/node8/bootstrap.js:128:22) at Timeout.setTimeout [as _onTimeout] (/var/runtime/node8/bootstrap.js:63:9) at ontimeout (timers.js:475:11) at tryOnTimeout (timers.js:310:5) at Timer.listOnTimeout (timers.js:270:5) END RequestId: 790098a8-de9c-11e9-b869-525400697544 Report RequestId: 790098a8-de9c-11e9-b869-525400697544 Duration:2ms Memory:256MB MaxMemoryUsed:35.578125MB |
同样的问题
注释的这一段,运行OK。
现在运行的这一段,报错。
两次运行的结果如下:
上面是第一次调用的,注释掉之后上传再调用,就是下面的这个错,为什么???
诡异哦