朋友圈表:
{
"bsonType": "object",
"required": ["feed_id", "user_id", "content", "comment_type"],
"permission": {
"read": true,
"create": true,
"update": true,
"delete": true
}
.....
评论表
{
"bsonType": "object",
"required": ["feed_id", "user_id", "content", "comment_type"],
"permission": {
"read": true,
"create": true,
"update": true,
"delete": true
},
"properties": {
"_id": {
"description": "存储文档 ID(文章 ID),系统自动生成"
},
"feed_id": {
"bsonType": "string",
"description": "feed ID,feeds 表中的`_id`字段"
},
"user_id": {
"bsonType": "string",
"description": "评论者ID,参考`uni-id-users` 表",
"forceDefaultValue": {
"$env": "uid"
},
"foreignKey": "uni-id-users._id"
},
"user_nickname": {
"bsonType": "string",
"description": "评论者昵称"
},
"content": {
"bsonType": "string",
"description": "评论内容",
"title": "评论内容",
"trim": "both"
},
"like_count": {
"bsonType": "int",
"description": "评论喜欢数、点赞数",
"defaultValue": 0
},
"type": {
"bsonType": "int",
"description": "回复类型: 0 针对文章的回复 1 针对评论的回复",
"defaultValue": 0
},
"to_user_id": {
"bsonType": "string",
"description": "被回复的评论用户ID,comment_type为1时有效",
"foreignKey": "uni-id-users._id"
},
"to_nickname": {
"bsonType": "string",
"description": "回复评论者昵称"
},
"to_comment_id": {
"bsonType": "string",
"description": "被回复的评论ID,comment_type为1时有效",
"foreignKey": "feed-comments._id"
},
"comment_date": {
"bsonType": "timestamp",
"description": "评论发表时间",
"forceDefaultValue": {
"$env": "now"
}
},
"comment_ip": {
"bsonType": "string",
"description": "评论发表时 IP 地址",
"forceDefaultValue": {
"$env": "clientIP"
}
}
}
}