云数据库如何判断属性存在和不存在呢?

发布于 7 年前作者 jing552847 次浏览最后编辑 7 年前来自 ask

比如:

集合中有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 回复
yangchang
yangchang1 楼5 年前

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