async shuju() {
let res = await db.collection('tong_baogao').aggregate()
.lookup({
from: 'taizhang',
localField: 'uid',
foreignField: '_id',
as: 'abc',
})
.end()
console.log(res,"看res")
} 产品分类: uniCloud/App
async shuju() {
let res = await db.collection('tong_baogao').aggregate()
.lookup({
from: 'taizhang',
localField: 'uid',
foreignField: '_id',
as: 'abc',
})
.end()
console.log(res,"看res")
} 暂无
出现查询结果
报错:
21:19:49.148 [本地运行:阿里云:ziliao]运行日志:
21:19:49.204 [本地运行:阿里云:ziliao]本地运行云对象【taizhang-shiwu】...
21:19:51.917 [本地运行]Error: lookup方法内只允许使用子查询(let+pipeline)方式
1***@qq.com (作者)
嗯,是的,现在只能用子查询,我是按照文档上的方法做的,现在应该是版本更新了,只能用子查询。
另外就是请问老师,这个聚合查询,查询数据条数和数据内容不能在一个聚合里面查出来呀?
使用count(<string>)这个方法值取到条数。是不是只能分开取条数和内容呀?
2025-10-10 15:59
DCloud_uniCloud_CRL
回复 1***@qq.com: 只能分开查询
2025-10-10 20:33