# db.command.in

Query filter, indicating that the value of a field is required to be out of the given array.

Method signature:

function nin(values: any[]): Command

Sample code

Find out the todos whose progress is neither 0 nor 100

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: _.nin([0, 100])
    })
    .get()
  } catch(e) {
    console.error(e)
  }
}
点击咨询小助手