Collection.watch / Query.watch 文档错误
const db = wx.cloud.database() const watcher = db.collection( 'todos' ).where({ _openid: 'xxx' // 填入当前用户 openid }).watch({ onChange: (res) => { console.log(res.data) }, onError: (err) => { console.error(err) } }) |
打印的res没有data字段,为undefined
3 回复
不好意思,是 API 文档示例错误,是有这几个字段。请看https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/database/realtime.html
