html52.com
我爱小程序-开发者交流社区

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

问题模块 框架类型 问题类型 终端类型 AppID 基础库版本
云开发 小程序 Bug 工具 wx16d645784c2ea137 2.4.0


比如:

集合中有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)              //查询不

})


评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付