微信小程序云开发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
})



标签:微信小程序

返回前面的内容

相关阅读 >>

微信小程序源码分享

微信小程序api 视频-保存视频

微信小程序云开发 api数据库查询记录

微信小程序api 绘图createlineargradient(创建线性渐变)

微信小程序 工具库类threejs

微信小程序api-设备-振动

微信小程序 扫码支付

微信小程序api 用户信息 wx.getuserinfo(object)

微信小程序api-设备-用户截屏事件

微信小程序工具 概览

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




打赏

取消

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

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

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

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

评论

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