//user表
{
"_openid":string//openid
"basicAdmin":true
}
//test表权限
{
"read": "doc._openid == auth.openid || get(`database.user.${auth.openid}`).basicAdmin==true",
"write": "get(`database.user.${auth.openid}`).basicAdmin==true"
}
//本地测试代码
test() {
db.collection('test').add({
data:{
text:'123'
}
})
.then(res => {
console.log(res)
})
},
//控制台打印
VM3299 WAService.js:2 Unhandled promise rejection Error: errCode: -502003 database permission denied | errMsg: Permission denied
at success (VM3299 WAService.js:2)
at r.success (VM3299 WAService.js:2)
at u (VM3299 WAService.js:2)
at Object.success (VM3299 WAService.js:2)
at a (VM3299 WAService.js:2)
at VM3299 WAService.js:2
at Mi (VM3299 WAService.js:2)
at VM3299 WAService.js:2
at VM15 asdebug.js:1
at C (VM15 asdebug.js:1)(env: Windows,mp,1.05.2201240; lib: 2.23.2)
问题出哪了求解?
对应的是_id 搞错了 { "_id":string//openid "basicAdmin":true }