seaton
seaton
  • 发布:2021-11-10 17:45
  • 更新:2021-11-12 11:06
  • 阅读:650

添加"forceDefaultValue": { "$env": "uid"}后,新增失败

分类:uniCloud

错误提示: “未能获取当前用户信息:30205 | 当前用户为匿名身份”
新增操作:

this.form = {  
    type:'work',  
    title:'标题',  
    content:'测试',  
}  
db.collection('note').add(this.form);

node.schema.json

{  
    "bsonType": "object",  
    "required": [],  
    "permission": {  
        "read": true,  
        "create": true,  
        "update": true,  
        "delete": true  
    },  
    "properties": {  
        "_id": {  
            "description": "ID,系统自动生成"  
        },  
        "type": {  
            "description": "类型,work:工作,live:生活"  
        },  
        "title": {  
            "description": "标题"  
        },  
        "content": {  
            "description": "内容"  
        },  
        "user_id": {  
            "description": "创建人",  
            "forceDefaultValue": {  
                "$env": "uid"  
            }  
        }  
    }  
}
2021-11-10 17:45 负责人:无 分享
已邀请:
DCloud_uniCloud_WYQ

DCloud_uniCloud_WYQ

这个配置要求用户必须是登录状态

该问题目前已经被锁定, 无法添加新回复