Why Mongoose doesn't validate on update?

后端 未结 6 2601
故里飘歌
故里飘歌 2020-11-30 00:07

I have this code

var ClientSchema = new Schema({
  name: {type: String, required: true, trim: true}
});

var Client = mongoose.mode(\'Client\', ClientSchema)         


        
6条回答
  •  误落风尘
    2020-11-30 00:58

    If you add this option in your config of mongoose it works:

    mongoose.set('runValidators', true)

提交回复
热议问题