44 lines
1.1 KiB
JSON
44 lines
1.1 KiB
JSON
{
|
|
"bsonType": "object",
|
|
"required": ["uid", "fid", "create_time"],
|
|
"permission": {
|
|
"read": true,
|
|
"create": "doc.uid == auth.uid || 'admin' in auth.role",
|
|
"update": "doc.uid == auth.uid || 'admin' in auth.role",
|
|
"delete": "doc.uid == auth.uid || 'admin' in auth.role"
|
|
},
|
|
"properties": {
|
|
"_id": {
|
|
"bsonType": "objectId",
|
|
"description": "自动生成的文档ID"
|
|
},
|
|
"uid": {
|
|
"bsonType": "string",
|
|
"title": "用户标识",
|
|
"foreignKey": "uni-id-users._id",
|
|
"trim": "both",
|
|
"minLength": 24,
|
|
"maxLength": 24,
|
|
"errorMessage": "用户ID必须为24位合法ObjectId"
|
|
},
|
|
"fid": {
|
|
"bsonType": "string",
|
|
"title": "关联对象ID",
|
|
"foreignKey": "uni-id-users._id",
|
|
"trim": "both",
|
|
"minLength": 24,
|
|
"maxLength": 24,
|
|
"errorMessage": "关联ID必须为24位合法ObjectId"
|
|
},
|
|
"create_time": {
|
|
"bsonType": "timestamp",
|
|
"title": "创建时间",
|
|
"defaultValue": {
|
|
"$env": "now"
|
|
}
|
|
}
|
|
},
|
|
"indexes": [
|
|
{"uid": 1, "fid": 1}
|
|
]
|
|
} |