找出进度小于或等于 50 的 todo
const _ = db.command
db.collection('todos').where({
progress: _.lte(50)
})
.get({
success: console.log,
fail: console.error
})
db.command.gt
查询筛选条件,表示字段需大于指定值。可以传入 Date 对象用于进行日期比较。
方法签名:
function gt(value: number | Date): Command
示例代码
找出进度大于 50 的 todo
const _ = db.command
db.collection('todos').where({
progress: _.gt(50)
})
.get({
success: console.log,
fail: console.error
})
db.command.gte
查询筛选条件,表示字段需大于或等于指定值。可以传入 Date 对象用于进行日期比较。
方法签名:
function gte(value: number | Date): Command
示例代码
找出进度大于或等于 50 的 todo
const _ = db.command
db.collection('todos').where({
progress: _.gte(50)
})
.get({
success: console.log,
fail: console.error
})
db.command.in
查询筛选条件,表示字段的值需在给定的数组内。
方法签名:
function in(values: any[]): Command
示例代码
找出进度为 0 或 100 的 todo
const _ = db.command
db.collection('todos').where({
progress: _.in([0, 100])
})
.get({
success: console.log,
fail: console.error
})
db.command.in
查询筛选条件,表示字段的值需不在给定的数组内。
方法签名:
function nin(values: any[]): Command
示例代码
找出进度不是 0 或 100 的 todo
const _ = db.command
db.collection('todos').where({
progress: _.nin([0, 100])
})
.get({
success: console.log,
fail: console.error
})
标签:微信小程序
相关阅读 >>
更多相关阅读请进入《微信小程序》频道 >>
Vue.js 设计与实现 基于Vue.js 3 深入解析Vue.js 设计细节
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者