请问使用lookup进行联表查询报如图所示的错误是什么原因?
// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database()
// 云函数入口函数
exports.main = async (event, context) => {
return await db.collection('activity')
.aggregate()
.lookup({
from: 'club',
localfield: 'club',
foreignField: '_id',
as: 'clubList'
})
.end()
}
两个数据库如图所示
1、确认云函数部署了;
2、确认在云控制台里,脚本运行成功了;
{"errorCode":1,"errorMessage":"user code exception caught","stackTrace":"Error: collection.aggregate:fail -502001 database request fail. [FailedOperation] Failed operation. Please check your request, but if the problem persists, contact us.\n at Object.toSDKError (/var/user/node_modules/wx-server-sdk/index.js:8094:19)\n at Object.checkError (/var/user/node_modules/wx-server-sdk/index.js:1422:23)\n at /var/user/node_modules/wx-server-sdk/index.js:1161:33\n at processTicksAndRejections (internal/process/task_queues.js:97:5)","statusCode":430}