https://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloud/guide/database/security-rules.html。
目前test数据库中自定义安全规则如下:
{
"read": "auth.openid in get(`database.test.${doc._id}`).sharedUsers",
"write": false,
}
为什么我的 sharedUser 中明明包括了当前用户的 openid 在查询test库中所有 sharedUsers中包括了当前用户的openid的记录时会一直提示:database permission denied。
查询命令如下:
const result = await db
.collection("test")
.where({
sharedUsers: openid,
// _openid: openid,
}).get();
如果我把 read 设置为 true,则可以查询出来。
## 更新
发现即使设置为创建者都是没有权限的:
{
"read": "doc._openid == auth.openid",
"write": "doc._openid == auth.openid"
}
对此只想说mmp