uni-app PERMISSION_ERROR:未找到集合[my-gallery]对应的schem
uni-app PERMISSION_ERROR:未找到集合[my-gallery]对应的schem
产品分类:
uniCloud/App
开发环境 | 版本号 | 项目创建方式 |
---|---|---|
示例代码:
{
"bsonType": "object",
"permission": {
"create": true,
"delete": true,
"read": true,
"update": true
},
"properties": {
"_id": {
"description": "ID,系统自动生成"
},
"myid": {
"errorMessage": "{label}无效",
"order": 1,
"trim": "none",
"bsonType": "string",
"title": "编号",
"label": "编号",
"description": ""
},
"myname": {
"errorMessage": "{label}无效",
"order": 2,
"trim": "none",
"bsonType": "string",
"title": "名称",
"label": "名称",
"description": ""
},
"company": {
"errorMessage": "{label}无效",
"order": 3,
"trim": "none",
"enum": {
"collection": "my-company",
"field": "_id as value,myname as text",
"orderby": "create_date desc"
},
"bsonType": "string",
"title": "公司",
"label": "公司",
"description": ""
},
"yn": {
"errorMessage": "{label}无效",
"order": 4,
"defaultValue": "0",
"trim": "none",
"enum": [
{
"value": "0",
"text": "可用"
},
{
"value": "1",
"text": "不可用"
},
{
"value": "7",
"text": "作废"
}
],
"bsonType": "string",
"title": "状态",
"label": "状态",
"description": ""
},
"create_date": {
"errorMessage": "{label}无效",
"order": 5,
"forceDefaultValue": {
"$env": "now"
},
"trim": "none",
"bsonType": "timestamp",
"title": "创建时间",
"label": "创建时间",
"description": ""
},
"create_uid": {
"errorMessage": "{label}无效",
"order": 6,
"forceDefaultValue": {
"$env": "uid"
},
"trim": "none",
"bsonType": "string",
"title": "创建人",
"label": "创建人",
"description": ""
},
"file": {
"errorMessage": "{label}无效",
"order": "7",
"trim": "none",
"bsonType": "object",
"title": "文件对象",
"label": "文件对象",
"description": ""
},
"fileurl": {
"errorMessage": "{label}无效",
"order": "8",
"trim": "none",
"bsonType": "string",
"title": "文件地址",
"label": "文件地址",
"description": ""
}
},
"required": [
"company",
"myname"
]
}
操作步骤:
res = await dbJQL.collection(‘my-gallery’).add(updata);
预期结果:
成功
bug描述:
这个表在控制台是找得到的 是在云函数使用jql
奇怪的是选云端函数会报这个错,选择本地函数反而不报错,但是这样发布项目后就不能正常使用了,该怎么办
更多关于uni-app PERMISSION_ERROR:未找到集合[my-gallery]对应的schem的实战教程也可以访问 https://www.itying.com/category-93-b0.html
刚刚有新发现 不使用jql就可以成功
所以这个问题是在云函数使用jql才会出现的 麻烦官方跟进一下
更多关于uni-app PERMISSION_ERROR:未找到集合[my-gallery]对应的schem的实战教程也可以访问 https://www.itying.com/category-93-b0.html
感谢!遇到同样问题,去掉JQL就正常了
JQL更新逻辑有点问题,已处理,可以重试下。
刚刚试了一下 还是出这个错 undefined Error: [zhjql]: PERMISSION_ERROR:未找到集合[my-recruitmentpage]对应的schema
回复 3***@qq.com: 重新编辑一下schema使云端触发一下同步
回复 DCloud_云服务_moyang: 重新上传schema成功了 另外有个问题 在云函数没有jql的代码提示
在 uni-app 开发中,如果你遇到 PERMISSION_ERROR: 未找到集合[my-gallery]对应的schema
的错误,通常是因为你在使用云开发时,尝试访问一个不存在的集合(collection)或者没有正确配置该集合的权限。
可能的原因和解决方案:
-
集合名称错误:
- 确保你在代码中使用的集合名称
my-gallery
是正确的,并且已经在云开发控制台中创建了该集合。 - 如果集合名称拼写错误或者集合不存在,就会出现这个错误。
- 确保你在代码中使用的集合名称
-
集合权限配置:
- 在云开发控制台中,检查
my-gallery
集合的权限设置。确保当前用户有权限访问该集合。 - 默认情况下,集合的权限可能是“仅创建者可读写”,如果你需要其他用户也能访问,需要调整权限设置。
- 在云开发控制台中,检查
-
云环境配置:
- 确保你在代码中使用的云环境是正确的。如果你有多个云环境,确保你正在访问的是正确的环境。
- 你可以在
uniCloud.init
中指定云环境。
-
云函数或客户端代码:
- 如果你是在云函数中访问集合,确保云函数已经正确部署,并且云函数中的代码没有错误。
- 如果你是在客户端直接访问集合,确保你已经正确初始化了云开发环境。
示例代码:
// 初始化云开发环境
uniCloud.init({
provider: 'aliyun', // 或者 'tencent'
env: 'your-env-id' // 你的云环境ID
});
// 访问集合
const db = uniCloud.database();
const collection = db.collection('my-gallery');
// 查询数据
collection.get().then(res => {
console.log(res);
}).catch(err => {
console.error(err);
});