May 20, 2021 WeChat Mini Program Development Document
Specify the filter
The method signature is as follows:
function where(rule: object): Query
The method accepts a required object parameter rule, which defines the filter criteria
The sample code
Find to-dos for Unfinished Progress 50:
const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database()
exports.main = async (event, context) => {
try {
return await db.collection('todos').where({
done: false,
progress: 50
})
.get()
} catch(e) {
console.error(e)
}
}