t***@qq.com
t***@qq.com
  • 发布:2025-07-15 09:16
  • 更新:2025-08-11 11:52
  • 阅读:73

【报Bug】unicloud-db 在支付宝云下,where无法使用db.command.exists(false)

分类:uniCloud

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

操作步骤:

-

预期结果:

-

实际结果:

-

bug描述:

同代码下,unicloud-db在阿里云腾讯云下正常。

在支付宝云下
where参数:
type: db.command.or(
db.command.exists(false), //不存在
db.command.eq(0) // 等于 0
)

调试发现db.command.exists(false)没有效果,把type字段设置为int索引也没效果。

2025-07-15 09:16 负责人:无 分享
已邀请:
DCloud_uniCloud_CRL

DCloud_uniCloud_CRL

我测试没有问题呢,我的测试数据:

[  
{ name: "1", type: 0 },   
{ name: "2", type: 1 },  
{ name: "3" }  
]

查询语句:

db.collection('test').where({  
        type: db.command.or([  
            db.command.exists(false),  
            db.command.eq(0)  
        ])  
    }).get()

结果:

{"data":[{"_id":"6875c9dfeee0dd702f64f621","name":"1","type":0},{"_id":"6875c9dfeee0dd702f64f623","name":"3"}]}
t***@qq.com

t***@qq.com (作者)

得unicloud-db组件下,试试看?

风之源

风之源 - 我这么闲给你评论,是因为我的问题还没有人回答~

你这没有中括号[],条件类型不对

D***@ikinloop.com

D***@ikinloop.com

我发现一个 BUG
前端使用 unicloud-db 组件,连接支付宝云数据库。然后前端动态修改 where 条件,不生效,总是使用首次的 where 条件。
请问如何解决?

如: 后续无论如何修改 where_forleave ,都不起作用 <unicloud-db ref="udb_forleave" collection="cy-lvshi-forleave-record" where="where_forleave" loadtime="manual"
v-slot:default="{data,pagination,loading,error}" >
</unicloud-db>

// this.where_forleave = 'lvshi_userid==="${this.formDataId}" && forleave_date==="${item.appoint_date}"'
// this.where_forleave = 'forleave_date=="2025-08-06"'
// this.where_forleave = item.appoint_date
this.where_forleave = 'forleave_date=="' + item.appoint_date + '"'
console.log("this.where_forleave = " , this.where_forleave)

this.$refs.udb_forleave.loadData({} , datalist=>{

这里的 datalist ,总是首次 where 条件的记录。

要回复问题请先登录注册