要搜索的字段不存在时,数据库无法搜索
发布于 6 年前 作者 tiantao 5671 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)

要搜索的数据库字段可能不存在,where里面应该怎么填?

例如:Ethernet字段,要搜索的数据库里面可能没有

const promise = db.collection(event.part).skip(i * MAX_LIMIT).limit(MAX_LIMIT).where({

   Ethernet: event.paras.ethernet > ‘0’ ? _.gte(event.paras.ethernet):

        db.RegExp({

          regexp: “.*”,

          options: ‘i’,

      }),

}).count({

})

我这样填,event.paras.ethernet='0’时,搜到0条记录

  • 预期表现

希望event.paras.ethernet ='0’时,don’t care Ethernet字段,该字段存在或者不存在,都不care

  • 复现路径
  • 提供一个最简复现 Demo
1 回复

这个问题有没有说法?目前不支持,以后会支持吗?

回到顶部