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 nfc-nfcf标签

微信小程序api 背景音频-暂停播放

微信小程序api 相机-监听器

微信小程序api 图片-全屏预览图片

微信小程序媒体组件 live-player

微信小程序api 上传、下载

微信小程序 广告-grid广告

微信小程序 即时配送接口(商家查看)-相关接口和事件

微信小程序工具 beta版本下载

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

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




打赏

取消

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

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

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

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

评论

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