SDK数据库 Command查询字段操作符


本文整理自网络,侵删。

Command.exists(value: boolean): Command

支持端:小程序 2.8.3, 云函数 1.2.1, Web

判断字段是否存在

参数

value: boolean

返回值

Command

示例代码

找出存在 tags 字段的记录

const _ = db.command
db.collection('todos').where({
  tags: _.exists(true)
})
.get({
  success: console.log,
  fail: console.error
})

Command.mod(divisor: number, remainder: number): Command

支持端:小程序 2.8.3, 云函数 1.2.1, Web

查询筛选操作符,给定除数 divisor 和余数 remainder,要求字段作为被除数时 value % divisor = remainder。

参数

divisor: number

remainder: number

返回值

Command

示例代码

找出进度为 10 的倍数的字段的记录

const _ = db.command
db.collection('todos').where({
  progress: _.mod(10, 0)
})
.get({
  success: console.log,
  fail: console.error
})



标签:微信小程序

相关阅读 >>

微信小程序 体验评分

微信小程序api 绘图rect创建矩形

微信小程序api 绘图stroke(对当前路径进行描边)

微信小程序api 文件-获取文件管理器

微信小程序api 绘图setfontsize(设置字号)

微信小程序地图 map

微信小程序 即时配送接口(商家查看)-配送公司信息

微信小程序 小程序使用getallaccount

微信小程序 createqrcode

微信小程序api 文件-获取已保存的本地缓存文件列表

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




打赏

取消

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

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

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

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

评论

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