db.command.in

查询筛选条件,表示字段的值需不在给定的数组内。

方法签名:

  1. function nin(values: any[]): Command

示例代码

找出进度不是 0 或 100 的 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: _.nin([0, 100])
  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.nin.html