代码
const db = wx.cloud.database()const watcher = db.collection('todos').where({
team: 'our dev team'}).watch({
onChange: function(snapshot) {
console.log('docs\'s changed events', snapshot.docChanges)
console.log('query result snapshot after the event', snapshot.docs)
console.log('is init data', snapshot.type === 'init')
},
onError: function(err) {
console.error('the watch closed because of error', err)
}})watcher.close()
运行报这个错db.collection(…).where(…).watch is not a function;at “pages/loging/loging” page lifeCycleMethod onLoad function
TypeError: db.collection(…).where(…).watch is not a function
at ye.onLoad ())
at ye.<anonymous> (WAService.js:1:1315997)
at ye.p.__callPageLifeTime__ (WAService.js:1:1315742)
at Ct (WAService.js:1:1330692)
at WAService.js:1:1333863
at At (WAService.js:1:1334356)
at Function.<anonymous> (WAService.js:1:1337746)
at i.<anonymous> (WAService.js:1:1307261)
at i.emit (WAService.js:1:417150)
at Object.emit (WAService.js:1:576442)