我在写注册的时候是这样的:
var User= new Schema({
username: { type: String, required: true, index: { unique: true } },
password: { type: String, required: true },
email: { type:String, required: true}
});
User.methods.comparePasswod = fn;
但是我登录的时候不用写上email,但是这里却设了required: true。怎么办啊?
4 回复