diff --git a/collection/opendb-news-articles/collection.json b/collection/opendb-news-articles/collection.json index 33de6b6..0bec6d6 100644 --- a/collection/opendb-news-articles/collection.json +++ b/collection/opendb-news-articles/collection.json @@ -2,6 +2,12 @@ "schema": { "bsonType": "object", "required": ["user_id", "title", "content", "article_status", "view_count", "like_count", "is_sticky", "is_essence", "comment_status", "comment_count","mode"], + "permission": { + ".read": true, + ".create": "auth.uid != null", + ".update": "doc.uid == auth.uid", + ".delete": "doc.uid == auth.uid" + }, "properties": { "_id": { "description": "存储文档 ID(用户 ID),系统自动生成" @@ -37,19 +43,31 @@ }, "view_count": { "bsonType": "int", - "description": "阅读数量" + "description": "阅读数量", + "permission": { + ".write": false + } }, "like_count": { "bsonType": "int", - "description": "喜欢数、点赞数" + "description": "喜欢数、点赞数", + "permission": { + ".write": false + } }, "is_sticky": { "bsonType": "bool", - "description": "是否置顶" + "description": "是否置顶", + "permission": { + ".write": false + } }, "is_essence": { "bsonType": "bool", - "description": "阅读加精" + "description": "阅读加精", + "permission": { + ".write": false + } }, "comment_status": { "bsonType": "int", @@ -59,7 +77,10 @@ }, "comment_count": { "bsonType": "int", - "description": "评论数量" + "description": "评论数量", + "permission": { + ".write": false + } }, "last_comment_user_id": { "bsonType": "string", @@ -72,11 +93,17 @@ }, "publish_date": { "bsonType": "timestamp", - "description": "发表时间" + "description": "发表时间", + "defaultValue": { + "$env": "now" + } }, "publish_ip": { "bsonType": "string", - "description": "发表时 IP 地址" + "description": "发表时 IP 地址", + "forceDefaultValue": { + "$env": "clientIP" + } }, "last_modify_date": { "bsonType": "timestamp",