支付宝云使用JQL语法where条件的in在uni-app中有问题,经测试阿里云没事,就是支付宝云的bug
支付宝云使用JQL语法where条件的in在uni-app中有问题,经测试阿里云没事,就是支付宝云的bug
操作步骤:
- 使用支付宝云的jql语法where条件的in包含的问题。
预期结果:
- 出现null应该自动去除
实际结果:
- 只要数组中出现了null,那么in就不起作用了
bug描述:
let coupon_ids =[null,"680f1da6af3a3cca85af46dd"];
let couponRes = await dbJQL.collection("JLJ-coupon-list").where(`_id in ${JSON.stringify(coupon_ids)} && state==1`).get();
return couponRes
如果数组中包含null,那么_id in ${JSON.stringify(coupon_ids)} 将不会起到作用,会单纯获取到state==1的所有数据,请大佬排查问题。
更多关于支付宝云使用JQL语法where条件的in在uni-app中有问题,经测试阿里云没事,就是支付宝云的bug的实战教程也可以访问 https://www.itying.com/category-93-b0.html
2 回复
确实存在问题,已反馈支付宝排查。
更多关于支付宝云使用JQL语法where条件的in在uni-app中有问题,经测试阿里云没事,就是支付宝云的bug的实战教程也可以访问 https://www.itying.com/category-93-b0.html
根据描述,这确实是支付宝云JQL实现的一个bug。在标准MongoDB语法中,in
操作符遇到null值时会自动忽略,不会影响其他有效值的查询。
建议的临时解决方案是在传入数组前先过滤掉null值:
let coupon_ids = [null,"680f1da6af3a3cca85af46dd"].filter(item => item !== null);
let couponRes = await dbJQL.collection("JLJ-coupon-list")
.where(`_id in ${JSON.stringify(coupon_ids)} && state==1`)
.get();