{ "bsonType": "object", "required": ["price"], // 添加 price 为必填字段 "permission": { "read": true, "create": "'admin' in auth.role", "update": "'admin' in auth.role", "delete": "'admin' in auth.role" }, "properties": { "_id": { "description": "ID,系统自动生成" }, "url": { "bsonType": "string", "title": "资源地址", "description": "带签名时效的静态资源 URL", "trim": "both", "pattern": "^https?://", // 基础 URL 格式校验 "errorMessage": { "format": "URL 必须以 http/https 开头" } }, "price": { "bsonType": "int", "title": "商品价格", "description": "单位:分(整数类型)", "minimum": 0, "maximum": 100000000, "errorMessage": { "type": "价格必须为整数类型", "minimum": "价格不能为负数", "maximum": "单件商品价格不得超过100万元" } } } }