{ "bsonType": "object", "required": ["goods_id", "sku_id", "amount"], "permission": { "read": true, "create": true, "update": "doc.user_id == auth.uid", "delete": "doc.user_id == auth.uid" }, "properties": { "_id": { "description": "存储文档 ID(SKU ID),系统自动生成" }, "goods_id": { "bsonType": "string", "description": "商品 id,参考 opendb-mall-goods 表", "foreignKey": "opendb-mall-goods._id" }, "goods_name": { "bsonType": "string", "description": "商品名称" }, "sku_id": { "bsonType": "string", "description": "SKU ID", "foreignKey": "opendb-mall-sku._id" }, "sku_name": { "bsonType": "string", "description": "SKU名称,多个组合>" }, "price": { "bsonType": "int", "description": "价格/规格价格,以分为单位,避免浮点计算的精度问题" }, "shop_id": { "bsonType": "string", "title": "店铺", "foreignKey": "tian-mall-shops._id" }, "market_price": { "bsonType": "int", "description": "市场价,以分为单位,避免浮点计算的精度问题" }, "goods_thumb": { "bsonType": "string", "description": "商品缩略图,加入购物车时候的商品图、型号图,防止商品删除", "title": "缩略图地址", "pattern": "^(http:\/\/|https:\/\/|\/|.\/|@\/)\\S", "trim": "both" }, "amount": { "bsonType": "int", "description": "数量" }, "create_date": { "bsonType": "timestamp", "description": "创建时间", "defaultValue": { "$env": "now" } }, "update_date": { "bsonType": "timestamp", "description": "修改时间", "defaultValue": { "$env": "now" } }, "user_id": { "bsonType": "string", "description": "用户uid,参考 uni-id-users 表", "foreignKey": "uni-id-users._id", "defaultValue": { "$env": "uid" } } } }