db.collection('pois')
.aggregate()
.lookup({
from: 'requests',
let: {
id: '$reqId',
collect: '$isCollect'
},
pipeline: $.pipeline()
.match(_.expr($.and([
$.eq(['$reqId','$$id']),
$.eq(['$userId','ok']),
$.eq(['$$collect', 1])
]))).done(),
as: 'collectList'
})
.end()
SQL查询内容:pois.reqId 与 requests.reqId关联,且pois.isCollect=1,且requests.userId='ok',
上述SQL执行后发现:pois.isCollect=1和requests.userId='ok'没有生效,请问如何改写?
已解决。https://developers.weixin.qq.com/community/develop/article/doc/000ee6287e8a2035cc9b713245f413