const db = uniCloud.database({
clientInfo: this.getClientInfo()
});
return await db.collection('used-car').aggregate()
.lookup({
from: 'companies',
let: {
company_id: '$company',
},
pipeline: [ //
{
$match: {
$expr: {
$eq: ['$_id', '$$company_id']
},
}
},
{
$project: {
_id: 1,
name: 1,
group_id: 1
}
}
],
as: 'companyInfo'
})
.unwind('$companyInfo')
.lookup({
from: 'company-group',
let: {
group_id: '$companyInfo.group_id',
},
pipeline: [{
$match: {
$expr: {
$eq: ['$_id', '$$group_id']
},
}
}],
as: 'groupInfo'
})
.unwind('$groupInfo')
.project({
max_bid: 0,
_id: 1,
})
.end()
上面这段代码运行正常,且正确返回理想数据,当时如果吧database换成databaseForJQL就会报错"Cannot read properties of undefined (reading 'map')",文档上不是说JQL API支持使用聚合操作读取数据吗?
1***@163.com (作者)
请问如果用JQL他的搭配写法在文档哪个位置
2024-12-16 08:33