(已解决)小程序搜索查询数据库多字段正则匹配问题

发布于 7 年前作者 jing815038 次浏览最后编辑 7 年前来自 ask

where({

    description1: db.RegExp({

        regexp: keyValue,

        options: ‘i’,

    })

})

如果还要以‘’或‘’的方式匹配description2该怎么写呢?

文档说不能用db.command。

求解?

1 回复
yang47
yang471 楼5 年前
const _ = db.command
db.collection('todo').where(_.or([
  {    progress: _.gt(80)
  },
  {    done: true
  }
]))

参考上述代码解决