我有一个带有类型记录的用户模式,下面是我的界面
interface IUser{ name: string; email: string; password: string; isAdmin: boolean; }
下面是用户模式
const UserSchema = new Schema<IUser>( name: { type: String, required: true, email: { type: String, required: true, unique: true, validate: [validator.isEmail, "Please provide a valid email"], password: { type: String, required: true, minlength: 8, isAdmin: { type: Boolean, required: true, default: false, timestamps: true,