db.collection(‘userConfig’).doc(‘W-KtZ7dokuiP9MhK’).set({
data: {
aaa: “1”
},
success: function (res) {
},
fail:function(res){
console.log(“回调失败”)
console.log(res)
}
})
以上是问题代码,如果是开发者本人进行修改操作的话,就可以修改成功,但如果是其他用户进行数据修改的话就会失败,下面是失败时候的异常代码
注:数据库的权限我选的是第一个(所有用户可读,仅创建者及管理员可写)
Error: errCode: -502001 database request fail | errMsg: Update Fail: write errors: [{E11000 duplicate key error collection: tnt-itjb2l3ea.userConfig index: _id_ dup key: { : “W-KtZ7dokuiP9MhK” }}]
at new t (WACloud.js:1)
at Function.success (WACloud.js:1)
at Object.success (WAService.js:1)
at o (WAService.js:1)
at Function.<anonymous> (WAService.js:1)
at t.function.setTimeout (appservice?t=1541738237446:1161)
at WAService.js:1
at WAService.js:1