微信小程序云开发API 查询筛选条件


当前第2页 返回上一页

找出进度小于或等于 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
})



标签:微信小程序

返回前面的内容

相关阅读 >>

sdk数据库 database服务端时间的引用

sdk数据库 aggregate传递字段

微信小程序api nfc-nfcv标签

sdk数据库 database创建集合

兼容

微信小程序表单组件 表单组件 picker

微信小程序 小程序使用mockupdateorder

微信小程序 小程序代码构成

微信小程序api 录音-停止录音

微信小程序api 录音-获取录音管理器

更多相关阅读请进入《微信小程序》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...