云数据库如何判断属性存在和不存在呢?
发布于 6 年前 作者 jing55 2705 次浏览 来自 问答

比如:

集合中有2条数据

userInfo1 : {id:1,tuan:{a:1,b:2}}

userInfo1 : {id:2}                没有tuan这个属性        

我用现有的api如何查询出  有tuan属性  的数据呢

const db = wx.cloud.database();

const _ = db.command

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

‘tuan’: _.neq(null)

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

console.log(res)              //查询不

})

1 回复

原来是数据权限的问题,已解决

回到顶部