db.command.gte

查询筛选条件,表示字段需大于或等于指定值。

方法签名:

  1. function gte(value: number): Command

示例代码

找出进度大于或等于 50 的 todo

  1. const cloud = require('wx-server-sdk')
  2. cloud.init()
  3. const db = cloud.database()
  4. const _ = db.command
  5. exports.main = async (event, context) => {
  6. try {
  7. return await db.collection('todos').where({
  8. progress: _.gte(50)
  9. })
  10. .get()
  11. } catch(e) {
  12. console.error(e)
  13. }
  14. }

原文: https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-server-api/database/command.gte.html