exports.main = async (event, context) => {
return await db.collection('Staff').aggregate()
.match({
GroupID:event.id
})
.lookup({
from: 'EpidemicRegistration',
let: {
ccsrid: '$CSRID',
aDate:event.today
},
pipeline: $.pipeline()
.match(_.expr($.and([
$.eq(['$CSRID', '$$ccsrid']),
$.eq(['$Date', '$$aDate']),
$.eq(['$Type','0'])
])))
.project({
_id: 0,
ApproveState: 1,
Type: 1
})
.done(),
as: 'ER'
})
.end()
}
wx.cloud.callFunction({
name:'getApproveList',
match:{
id:'236',
today:'2021-08-16'
}
})
想法是在调用时传入两个参数(id,today)分别给云函数中(aDate:event.today)(GroupID:event.id),多次尝试后发现id可以接收到,但是在lookup
中let里面始终无法得到传入的参数,想问下通过什么方式可以将参数传入let中
这里应该是data吧