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
})



标签:微信小程序

相关阅读 >>

微信小程序 即时配送接口(商家查看)-附录 1:品类表

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

微信小程序 工具库类lottie

微信小程序 注册页面

微信小程序api 获取小程序页面二维码

微信小程序 多线程worker

微信小程序 小程序使用getallimmedelivery

微信小程序 收藏

微信小程序 运行时性能

微信小程序工具 第三方平台

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




打赏

取消

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

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

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

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

评论

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