return await db.collection('department').aggregate()
// 关联用户表
.lookup({
from: 'organization_user',
// localField: '_id',
// foreignField: 'department_id',
let: {
ids: '$_id'
},
pipeline: $.pipeline()
.match(_.expr($.and([
$.eq(['$department_id', '$$ids'])
])))
.done(),
as: 'user'
})
.end();
请求云函数错误: errCode: InternalServerError | errMsg: 云数据库系统错误 << arguments to $lookup must be strings, let: { ids: "$_id" } is type object
1 个回复
龙啸泽渊
因为阿里云是3.4的mongodb。。。你这个写法是3.6之后才有的