下面举一个例子,让我觉得这个问题更容易。我应该这样做,还是表现更好?我可能也希望稍后再添加一些内容。
user: new schema({
key: type.unique.string // uuid
, nickname: type.string
, username: type.unique.string
, password: type.string
, email: type.optional.string
, role: { type: String, required: true, default: 'user', enum: ['user', 'administrator'] }
, active: type.bool
, created: type.timestamp
, last: type.timestamp
, products: { type: [{ product: type.string, cost: type.number, when: type.timestamp, where: type.string }] }
, sessions: { type: [{ who: type.unique.string, when: type.timestamp, where: type.number, what: type.string }] }
})
答案 0 :(得分:2)