where中怎么实现或条件查询?
发布于 5 年前 作者 xiangchao 8230 次浏览 来自 问答

初级问题,文档看不懂。

我条件查询上边的数据库, 代码如下:,当条件是一个时候怎么查到查要的内容。

请问两个件怎么写呀!如我要查 sex是男的,age还要是20的怎么写这个条件查询语句呀!?

  db.collection("table").where({

    "id":id

  }).get()

    .then(res => {

      console.log(res.data)

      this.setData({

        table: res.data

      })

    })

    .catch(err => {

      console.error(err)

    })

 

 

1 回复
where({
  sex: '男',
  age: 20
})
回到顶部