unicloud:为什么表中没有的字段也能添加成功,而且自动生成的register_date也没有在列表中显示,设置必填字段"required": ["wx_openid"],没有传递也能创建成功,请问是什么情况?是不是我配置少了什么?
login.vue
async wxLogin(wxCode) {
try{
const {
openid
} = await getOpenId(wxCode)
const record = await db.collection('users').where({openid}).get()
if(record.affectedDocs < 1) {
const res = await db.collection('users').add({openid,nickName: randomNickName('微信用户', 8)})
}
}catch(e){
//TODO handle the exception
}
},
index.schema.json
{
"bsonType": "object",
"required": ["wx_openid"],
"permission": {
"read": true,
"create": true,
"update": true,
"delete": false
},
"properties": {
"_id": {
"description": "ID,系统自动生成",
"forceDefaultValue":{
"$env": "uid"
}
},
"user_ip": {
"description": "用户当前IP地址",
"forceDefaultValue": {
"$env": "clientIP"
}
},
"nickName": {
"bsonType": "string",
"label": "昵称",
"defaultValue": "",
"description": "用户昵称,登录获取的"
},
"avatarUrl": {
"bsonType": "string",
"label": "头像",
"defaultValue": "",
"description": "用户头像图片的 URL,登录获取的"
},
"wx_openid": {
"bsonType": "string",
"description": "微信小程序平台openid"
},
"register_date": {
"bsonType": "timestamp",
"description": "注册时间",
"forceDefaultValue": {
"$env": "now"
}
}
}
}
糖丶宝可梦 (作者)
那login.vue如何调用jql
2022-11-23 15:05