opendb/collection/opendb-news-comments/collection.json

92 lines
2.5 KiB
JSON
Raw Normal View History

{
"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": {
2020-10-28 20:21:38 +08:00
"read": true,
2021-04-25 18:00:05 +08:00
"create": "auth.uid != null",
2020-10-28 20:21:38 +08:00
"update": "doc.uid == auth.uid",
"delete": "doc.uid == auth.uid"
2020-10-27 15:01:37 +08:00
},
"properties": {
"_id": {
"description": "存储文档 ID文章 ID系统自动生成"
},
"article_id": {
"bsonType": "string",
2020-11-10 16:11:13 +08:00
"description": "文章IDopendb-news-posts 表中的`_id`字段",
"foreignKey":"opendb-news-articles._id"
},
"user_id": {
"bsonType": "string",
2020-10-27 18:21:58 +08:00
"description": "评论者ID参考`uni-id-users` 表",
"forceDefaultValue": {
"$env": "uid"
2020-11-10 16:11:13 +08:00
},
"foreignKey":"uni-id-users._id"
},
"comment_content": {
"bsonType": "string",
"description": "评论内容",
2020-12-23 20:20:34 +08:00
"title": "评论内容",
"trim":"right"
},
"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": "被回复的评论用户IDcomment_type为1时有效",
"foreignKey":"uni-id-users._id"
},
"reply_comment_id": {
"bsonType": "string",
2020-11-10 16:11:13 +08:00
"description": "被回复的评论IDcomment_type为1时有效",
"foreignKey":"opendb-news-comments._id"
},
"comment_date": {
"bsonType": "timestamp",
2020-10-27 15:01:37 +08:00
"description": "评论发表时间",
"forceDefaultValue": {
"$env": "now"
}
},
"comment_ip": {
"bsonType": "string",
"description": "评论发表时 IP 地址",
"forceDefaultValue": {
"$env": "clientIP"
}
}
}
},
"data": [],
"index": [
2020-11-24 16:00:21 +08:00
{
"IndexName": "article_id_",
"MgoKeySchema": {
"MgoIndexKeys": [{
"Name": "article_id",
"Direction": "1"
}],
"MgoIsUnique": false
}
},
{
"IndexName": "user_id_",
"MgoKeySchema": {
"MgoIndexKeys": [{
"Name": "user_id",
"Direction": "1"
}],
"MgoIsUnique": false
}
}
]
}