1、count查询记录个数
.js
//获取记录个数
btnNum(){
db.collection("demolist").count()
.then(res=>{
console.log(res)
})
},
.wxml
<button type="primary" bindtap="btnNum">查询个数</button>
2、.watch监听,实时更新数据
onLoad: function (options) {
db.collection("demolist").watch({
onChange:res=>{
this.setData({
dataArr:resdocs
})
},
onError:err=>{
console.log(err)
}
})
},