有两个表:
TableA 数据如下
[{_id:0,dsc:'aaaa'},
{_id:1,dsc:'bbbb'}]
TableB 数据如下
[{_id:0,a_id:0,score:10,age:20},
{_id:0,a_id:0,score:4,age:10},
{_id:0,a_id:1,score:2,age:22}]
现需要查询显示TableA的全部和TabelB的可以对应出来的,TableA._id=TableB.a_id,类似于left join。
并且符合条件TableB.score <= 5,TableB.age>=20
参考结果:
[{_id:0,dsc:'aaaa',blist[]},
{_id:1,dsc:'bbbb',blist[{score:2,age:22}]}]
https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/database/aggregate/Aggregate.lookup.html