# db.command.lt

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

Method signature:

function lt(value: number): Command

Sample code

Find out the todos whose progress is less 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: _.lt(50)
    })
    .get()
  } catch(e) {
    console.error(e)
  }
}
点击咨询小助手