收藏
回答

云数据库不更新

框架类型 问题类型 终端类型 AppID 基础库版本
小程序 需求 客户端 1111 2.6.2

arrived: function(e) {

var index = e.currentTarget.dataset.index

if (this.data.topIndex == 0) { //若是主队

this.data.homeTeamPlayer[index].arrived = !this.data.homeTeamPlayer[index].arrived

this.setData({

homeTeamPlayer: this.data.homeTeamPlayer

})

console.log(this.data.homeTeamPlayer)


wx.cloud.callFunction({ //调用数据库修改数据

name: 'teamUpdate',

data: {

homeTeam: this.data.homeTeam,

homeTeamPlayer: this.data.homeTeamPlayer

},

success: res => {

console.log(res)

}

})


} else {

this.data.visitTeamPlayer[index].arrived = !this.data.visitTeamPlayer[index].arrived

this.setData({

visitTeamPlayer: this.data.visitTeamPlayer

})

}

},

这是小程序页面homeTeamPlayer更改后调用云函数修改数据库

// 云函数入口文件

const cloud = require('wx-server-sdk')


cloud.init()

const db = cloud.database()


// 云函数入口函数

exports.main = async(event, context) => {

console.log(event.homeTeam)

console.log(event.homeTeamPlayer)

return await db.collection('teams').where({

teamName: event.homeTeam

})

.update({

data: {

teamPlayers: event.homeTeamPlayer

},

})

}

这是云函数


为啥更新不了啊,而且返回结果也没有stas{update:1}这样的res


求解呀

回答关注问题邀请回答
收藏
登录 后发表内容