{ "bsonType": "object", "required": ["user_id", "article_id", "months", "create_time"], // 必填字段 "permission": { "read": true, "create": "doc._id == auth.uid || 'admin' in auth.role", "update": "doc._id == auth.uid || 'admin' in auth.role", "delete": "doc._id == auth.uid || 'admin' in auth.role" }, "properties": { "_id": { "description": "ID,系统自动生成" }, "months": { "bsonType": "int", "title": "累计月数", "defaultValue": 0, "minimum": 0 }, "user_id": { "bsonType": "string", "title": "用户ID", "foreignKey": "uni-id-users._id", "trim": "both", "errorMessage": "用户ID不能为空" }, "article_id": { "bsonType": "string", "title": "文章ID", "trim": "both", "errorMessage": "文章ID不能为空" }, "gift_value": { "bsonType": "int", "title": "礼物价值", "minimum": 0, "defaultValue": 0, "errorMessage": "礼物价值不能小于1" }, "create_time": { "bsonType": "timestamp", "title": "创建时间", "defaultValue": { "$env": "now" // 自动填充服务器时间[1](@ref) } } } }