# Collection.where

Specifies filter conditions.

The method signature is shown as below:

function where(rule: object): Query

The method accepts a required object parameter rule to define the filter conditions.

Sample code

Find out the unfinished to-dos whose progress is 50:

const db = wx.cloud.database()
db.collection('todos').where({
  done: false,
  progress: 50
})
.get({
  success: console.log,
  fail: console.error
})
点击咨询小助手