db.command.lte
查询筛选条件,表示字段需小于或等于指定值。
方法签名:
function lte(value: number): Command
示例代码
找出进度小于或等于 50 的 todo
const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database()
const _ = db.command
exports.main = async (event, context) => {
try {
return await db.collection('todos').where({
progress: _.lte(50)
})
.get()
} catch(e) {
console.error(e)
}
}