const UserSchema = new Schema({ name: { type: String, unique: true, // 不可重复约束 required: true // 不可为空约束 }, password: { type: String, required: true }, token: { type: String } });
const UserSchema = new Schema({
name: {
type: String,
unique: true, // 不可重复约束
required: true // 不可为空约束
},
password: {
type: String,
required: true
},
token: {
type: String
}
});