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