2020-07-31 18:34:27 +08:00
|
|
|
|
{
|
|
|
|
|
"schema": {
|
|
|
|
|
"bsonType": "object",
|
|
|
|
|
"required": ["article_id", "user_id", "comment_content", "like_count", "comment_type", "reply_user_id", "reply_comment_id"],
|
2020-10-27 15:01:37 +08:00
|
|
|
|
"permission": {
|
2021-09-13 15:46:35 +08:00
|
|
|
|
"read": true,
|
2021-04-25 18:00:05 +08:00
|
|
|
|
"create": "auth.uid != null",
|
2021-09-13 15:46:35 +08:00
|
|
|
|
"update": "doc.user_id == auth.uid",
|
|
|
|
|
"delete": "doc.user_id == auth.uid"
|
2020-10-27 15:01:37 +08:00
|
|
|
|
},
|
2020-07-31 18:34:27 +08:00
|
|
|
|
"properties": {
|
|
|
|
|
"_id": {
|
|
|
|
|
"description": "存储文档 ID(文章 ID),系统自动生成"
|
|
|
|
|
},
|
|
|
|
|
"article_id": {
|
|
|
|
|
"bsonType": "string",
|
2020-11-10 16:11:13 +08:00
|
|
|
|
"description": "文章ID,opendb-news-posts 表中的`_id`字段",
|
2021-09-13 15:46:35 +08:00
|
|
|
|
"foreignKey": "opendb-news-articles._id"
|
2020-07-31 18:34:27 +08:00
|
|
|
|
},
|
|
|
|
|
"user_id": {
|
|
|
|
|
"bsonType": "string",
|
2020-10-27 18:21:58 +08:00
|
|
|
|
"description": "评论者ID,参考`uni-id-users` 表",
|
2021-09-13 15:46:35 +08:00
|
|
|
|
"forceDefaultValue": {
|
|
|
|
|
"$env": "uid"
|
|
|
|
|
},
|
|
|
|
|
"foreignKey": "uni-id-users._id"
|
2020-07-31 18:34:27 +08:00
|
|
|
|
},
|
|
|
|
|
"comment_content": {
|
|
|
|
|
"bsonType": "string",
|
2020-10-26 15:54:32 +08:00
|
|
|
|
"description": "评论内容",
|
2020-12-23 20:20:34 +08:00
|
|
|
|
"title": "评论内容",
|
2021-09-13 15:46:35 +08:00
|
|
|
|
"trim": "right"
|
2020-07-31 18:34:27 +08:00
|
|
|
|
},
|
|
|
|
|
"like_count": {
|
|
|
|
|
"bsonType": "int",
|
|
|
|
|
"description": "评论喜欢数、点赞数"
|
|
|
|
|
},
|
|
|
|
|
"comment_type": {
|
|
|
|
|
"bsonType": "int",
|
|
|
|
|
"description": "回复类型: 0 针对文章的回复 1 针对评论的回复"
|
|
|
|
|
},
|
|
|
|
|
"reply_user_id": {
|
|
|
|
|
"bsonType": "string",
|
2020-11-10 16:11:13 +08:00
|
|
|
|
"description": "被回复的评论用户ID,comment_type为1时有效",
|
2021-09-13 15:46:35 +08:00
|
|
|
|
"foreignKey": "uni-id-users._id"
|
2020-07-31 18:34:27 +08:00
|
|
|
|
},
|
|
|
|
|
"reply_comment_id": {
|
|
|
|
|
"bsonType": "string",
|
2020-11-10 16:11:13 +08:00
|
|
|
|
"description": "被回复的评论ID,comment_type为1时有效",
|
2021-09-13 15:46:35 +08:00
|
|
|
|
"foreignKey": "opendb-news-comments._id"
|
2020-07-31 18:34:27 +08:00
|
|
|
|
},
|
|
|
|
|
"comment_date": {
|
|
|
|
|
"bsonType": "timestamp",
|
2020-10-27 15:01:37 +08:00
|
|
|
|
"description": "评论发表时间",
|
|
|
|
|
"forceDefaultValue": {
|
|
|
|
|
"$env": "now"
|
|
|
|
|
}
|
2020-07-31 18:34:27 +08:00
|
|
|
|
},
|
|
|
|
|
"comment_ip": {
|
|
|
|
|
"bsonType": "string",
|
2020-10-26 15:54:32 +08:00
|
|
|
|
"description": "评论发表时 IP 地址",
|
|
|
|
|
"forceDefaultValue": {
|
|
|
|
|
"$env": "clientIP"
|
|
|
|
|
}
|
2020-07-31 18:34:27 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"data": [],
|
2021-09-13 15:46:35 +08:00
|
|
|
|
"index": [{
|
|
|
|
|
"IndexName": "article_id_",
|
|
|
|
|
"MgoKeySchema": {
|
|
|
|
|
"MgoIndexKeys": [{
|
|
|
|
|
"Name": "article_id",
|
|
|
|
|
"Direction": "1"
|
|
|
|
|
}],
|
|
|
|
|
"MgoIsUnique": false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"IndexName": "user_id_",
|
|
|
|
|
"MgoKeySchema": {
|
|
|
|
|
"MgoIndexKeys": [{
|
|
|
|
|
"Name": "user_id",
|
|
|
|
|
"Direction": "1"
|
|
|
|
|
}],
|
|
|
|
|
"MgoIsUnique": false
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-10-26 15:54:32 +08:00
|
|
|
|
]
|
2020-07-31 18:34:27 +08:00
|
|
|
|
}
|