【发布时间】:2021-08-08 17:37:06
【问题描述】:
如何比较password 和password_confirmation,如果它们不匹配,我将在错误消息中打印"Passwords don't match"?
const userSchema = new Schema(
{
username: {type: String, required: [true, "Please enter a username"], unique: [true, "Username taken"]},
password: {type: String, required: true, minLength: [8, "Minimum password lenth is 8"]},
password_confirmation: {type: String}
},
{ timestamps: true }
);
【问题讨论】:
-
不,答案可能已经过时了。 @AhmadHabib
标签: javascript database mongodb mongoose model