# db.command.gt

Query filter, indicating that the value of the field is required to be larger than the specified value.

Method signature:

function gt(value: number): Command

Sample code

Find out the todos whose progress is greater than 50

const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database()
const _ = db.command
exports.main = async (event, context) => {
  try {
    return await db.collection('todos').where({
      progress: _.gt(50)
    })
    .get()
  } catch(e) {
    console.error(e)
  }
}
点击咨询小助手