let res1 = await db.collection('questions').where({
bank_id:bank_id,
type_id:'676464e42f00b587adf226b9',
status:0
}).count();
const aggregate = qtcollection.aggregate() // 每次执行云函数会有独立的聚合实例
const res2 = await aggregate.match({
bank_id: bank_id,
type_id: '676464e42f00b587adf226b9',
status: 0
}).count('expensiveCount').end()

- 发布:2025-01-14 01:13
- 更新:2025-02-26 22:14
- 阅读:230
产品分类: uniCloud/支付宝小程序云
示例代码:
操作步骤:
在云对象中使用,where 后面使用count()方法,res1执行结果: Proxy ,无法得到数量
使用聚合操作才能得到数量
在云对象中使用,where 后面使用count()方法,res1执行结果: Proxy ,无法得到数量
使用聚合操作才能得到数量
预期结果:
返回具体总数
返回具体总数
实际结果:
执行结果: Proxy
执行结果: Proxy
最佳回复

hws007 - 我就是我!
const db = uniCloud.databaseForJQL();
let couRmb = db.collection('opendb-mall-sku')
.where('status==1')
.getTemp();
const mallgoods = db
.collection('opendb-mall-goods')
.where("status==1")
.getTemp();
const unit = db
.collection('sasa-goods-unit')
.field('_id,name')
.getTemp();
const goodslist = db.collection(mallgoods, unit)
.getTemp({
getCount: true
})
db.multiSend(goodslist, couRmb)
.then(res => {
console.log("res: " + JSON.stringify(res));
})
.catch(err => {
const error = err as UniCloudError
console.log("res: " + JSON.stringify(error));
});
yukio (作者)
感谢解惑,使用两种方法均可得到数据
2025-01-14 12:49
hws007
.getTemp({ getCount: true }) 这个支付宝,几时能支持
2025-02-21 23:35
DCloud_uniCloud_VK
回复 hws007: HBuilderX 4.52.2025020807-alpha 应该已修复了
2025-02-24 14:55
hws007
回复 DCloud_uniCloud_VK: 测试了,还不行 .getTemp({ getCount: true })
2025-02-25 00:30
hws007
回复 hws007: 测试了,还不行 ! 合并查询请求api multiSend ! .getTemp({ getCount: true })
2025-02-25 00:33
DCloud_uniCloud_CRL
回复 hws007: 给个示例和详细错误。
2025-02-25 20:13
hws007
回复 DCloud_uniCloud_CRL: 在下面我给了个代码
2025-02-26 22:14
hws007
回复 hws007: 读取出来的值,没有count
2025-02-26 22:15