//查询所有数据
onQuery: function() {
const db = wx.cloud.database()
// 查询当前用户所有的 counters
//db.collection('counters').get().then(res => { console.log(res.data) })
//查询所有数据并显示含有count字段的数据
//db.collection('counters').field({count:true}).get().then(res => { console.log(res.data) })
//查询在(不在)指定数组范围内的数据
db.collection('counters').where({
//查询count为0或count为100的数据
count: _.in([0,100])
//查询count不为0或count不为100的数据
// count: _.nin([0,100])
}).get({
success: res => {
this.setData({
queryResult: JSON.stringify(res.data, null, 2)
})
},
fail: err => {
wx.showToast({
icon: 'none',
title: '查询记录失败'
})
}
})
},