1***@qq.com
1***@qq.com
  • 发布:2021-12-03 11:12
  • 更新:2021-12-03 11:21
  • 阅读:333

【报Bug】getCount:true失效

分类:uniCloud

产品分类: uniCloud/App

示例代码:
let res1 = await collection.where({  
            filename: new RegExp(`.*${keywords}.*`, 'i')  
        })  
        .skip(skip) // 跳过前20条  
        .limit(limit) // 获取20条  
        .orderBy(orderField, orderType)  
        .get({  
            getCount: true  
        })

操作步骤:
let res1 = await collection.where({  
            filename: new RegExp(`.*${keywords}.*`, 'i')  
        })  
        .skip(skip) // 跳过前20条  
        .limit(limit) // 获取20条  
        .orderBy(orderField, orderType)  
        .get({  
            getCount: true  
        })

预期结果:
let res1 = await collection.where({  
            filename: new RegExp(`.*${keywords}.*`, 'i')  
        })  
        .skip(skip) // 跳过前20条  
        .limit(limit) // 获取20条  
        .orderBy(orderField, orderType)  
        .get({  
            getCount: true  
        })

实际结果:
let res1 = await collection.where({  
            filename: new RegExp(`.*${keywords}.*`, 'i')  
        })  
        .skip(skip) // 跳过前20条  
        .limit(limit) // 获取20条  
        .orderBy(orderField, orderType)  
        .get({  
            getCount: true  
        })

bug描述:

使用await时,getCount: true失效,没有返回count,使用getOne也失效

let res1 = await collection.where({  
            filename: new RegExp(`.*${keywords}.*`, 'i')  
        })  
        .skip(skip) // 跳过前20条  
        .limit(limit) // 获取20条  
        .orderBy(orderField, orderType)  
        .get({  
            getCount: true  
        })
2021-12-03 11:12 负责人:无 分享
已邀请:
DCloud_uniCloud_WYQ

DCloud_uniCloud_WYQ

getOne,getCount都是jql里面添加的功能,云函数里面目前不能用。即将推出云函数使用jql语法的扩展库。还有你确实需要先skip+limit再orderBy吗?

  • Syone

    现在云函数可以用了吗

    2023-06-05 18:20

  • DCloud_uniCloud_WYQ

    回复 Syone: 云函数已经能用jql扩展了 https://uniapp.dcloud.net.cn/uniCloud/jql-cloud.html

    2023-06-06 11:44

该问题目前已经被锁定, 无法添加新回复