opendb-news-favorite.schema.json 1.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
{
	"bsonType": "object",
	"required": ["user_id", "article_id"],
	"permission": {
		"read": "doc.user_id == auth.uid",
		"create": "auth.uid != null",
		"update": "doc.user_id == auth.uid",
		"delete": "doc.user_id == auth.uid"
	},
	"properties": {
		"_id": {
			"description": "ID,系统自动生成"
		},
		"article_id": {
			"bsonType": "string",
			"description": "文章id,参考opendb-news-articles表",
			"foreignKey": "opendb-news-articles._id"
		},
		"article_title": {
			"bsonType": "string",
			"description": "文章标题"
		},
		"user_id": {
			"bsonType": "string",
			"description": "收藏者id,参考uni-id-users表",
			"forceDefaultValue": {
				"$env": "uid"
			},
			"foreignKey": "uni-id-users._id"
		},
		"create_date": {
			"bsonType": "timestamp",
			"description": "收藏时间",
			"forceDefaultValue": {
				"$env": "now"
			}
		},
		"update_date": {
			"bsonType": "timestamp",
			"description": "更新\/修改时间",
			"forceDefaultValue": {
				"$env": "now"
			}
		}
	}
}