云数据库查询时where条件,没有起作用?
发布于 7 年前 作者 minqin 3011 次浏览 来自 问答

  return new Promise(function(resolvereject) {

    const db = wx.cloud.database()

    // 查询指定openid的用户

    db.collection(‘user’).where({

      // _openid: openid

      _openid: ‘0’ // 无论此处为何值都能查到数据

    }).get().then(res => {

      if(res.data.length === 1) {

        console.log(‘find’,res.data)

        resolve(res)

      }

      else {

        console.log(‘not find’)

      }

    }).catch(err => {

      reject(err)

    })

1 回复

猜当仅所有者可读时,_openid会被替换成用户的openid

回到顶部