云开发(学习笔记)聚合分组查询group()
按商品分类展示商品
return dbRes.match({
shopID: event.shopId
})
.group({
_id: {
sortName: '$sortItem.sortName'
},
list: $.push({
_id: '$_id',
goodsName: '$goodsName',
goodsDesc: '$goodsDesc',
goodsPrice: '$goodsPrice',
imgUrl: '$imgUrl'
})
})
.end().then(res => {
console.log(res);
return res
})