add collection/opendb-msg/opendb-msg.schema.json.

This commit is contained in:
linju 2021-05-21 17:29:47 +08:00 committed by Gitee
parent c8cf2b947d
commit 6d63428dc5

View File

@ -0,0 +1,65 @@
{
"schema": {
"bsonType": "object",
"required": ["to_uid", "body", "type"],
"permission": {
"read": "auto.uid == doc.to_uid",
"create": true,
"update": false,
"delete": false
},
"properties": {
"_id": {
"description": "ID系统自动生成"
},
"from_uid": {
"description": "消息发送方 UserID用于指定发送消息方帐号",
"forceDefaultValue": {
"$env": "uid"
}
},
"to_uid": {
"description": "消息接收方 UserID",
"bsonType": "string"
},
"is_read": {
"description": "是否已读",
"bsonType": "bool",
"forceDefaultValue": false
},
"create_date": {
"description": "消息发送时间戳",
"forceDefaultValue": {
"$env": "now"
}
},
"body": {
"bsonType": "object",
"description": "消息内容包含的键会随type变化。需要自己写valedateFunction验证"
},
"type": {
"bsonType": "string",
"enum": [{
"text": "文本",
"value": "text"
}, {
"text": "图像",
"value": "image"
}, {
"text": "语音",
"value": "sound"
}, {
"text": "视频",
"value": "video"
}, {
"text": "文件",
"value": "file"
}, {
"text": "位置",
"value": "location"
}]
}
}
},
"index": []
}