update is not a function?
发布于 7 年前 作者 kongyan 13795 次浏览 来自 官方Issues

//file: pages/meesage/message.js 

 

const db = wx.cloud.database();

markAsRead: function (messageId) {
    db.collection("messages").where({
      chatid: messageId,
      receiverid: app.globalData.openId
    }).update({
      data: {
        "isRead": true
      },
      success(res) {
        console.log("标记消息已读",res);
      }
    })
  },

我不知道这样到底是不是正确的了,社区找了半天,网上也没什么解决方法,现在迷失了,有说这是?不是云开发操作?😂求大家指正下。代码写在小程序的代码了面的,不是云函数里面。

报错信息是:TypeError: db.collection(…).where(…).update is not a function。

//记得之前都没问题呢,难道是我没测试到这里?要交货了出现各种问题……

2 回复

是的,没有这个接口,请仔细读文档。

小程序端:

没有db.col.where.update,

只有db.col.doc.update

我也碰到这个情况了,即使通过openid搜到的只有一条数据,也不能这么操作吗?

另外,为何同是这种操作,在模拟器和大部分机型中都没有问题,只有个别人出现错误。。。小菜鸟查了两天了才把问题定位到这里。。。囧。。。哭死了。。。

回到顶部