小程序雲開發,判斷數據庫表的兩個字段匹配 雲開發數據庫匹配之 and 和 or 的配合使用

雲開發數據庫匹配之 and 和 or 的配合使用

代碼:



  // 獲取成員消息
  onMsg2() {
    let that = this

    wx.cloud.init({
      env: 'gezi-ofhmx'
    })

    const DB = wx.cloud.database()
    const _ = DB.command;
    var aa = "1"
    var bb = "2"

    DB.collection('message_logging').where(_.and([{
          a: _.eq(aa).or(_.eq(bb))
        },
        {
          b: _.eq(aa).or(_.eq(bb))
        }
      ])).get()
      .then(res => {
        console.log('-------', res)
      })
  },

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章