yukio
yukio
  • 发布:2025-01-14 01:13
  • 更新:2025-02-26 22:14
  • 阅读:230

【报Bug】支付宝云使用count()方法无法获得数量

分类:uniCloud

产品分类: uniCloud/支付宝小程序云

示例代码:
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()

操作步骤:

在云对象中使用,where 后面使用count()方法,res1执行结果: Proxy ,无法得到数量
使用聚合操作才能得到数量

预期结果:

返回具体总数

实际结果:

执行结果: Proxy

bug描述:

支付宝免费版,简单查询获取不到count

2025-01-14 01:13 负责人:无 分享
已邀请:

最佳回复

DCloud_uniCloud_VK

DCloud_uniCloud_VK

已知问题,你可以直接res1.total 获取 或者执行下 res1 = JSON.parse(JSON.stringify(res1))

  • 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

DCloud

DCloud

HBuilderX 4.52.2025020807-alpha 已修复。

hws007

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));  
                });

要回复问题请先登录注册