问题描述
这是我的邮递员,我在这里
解决方法
如果您使用的是 mongoose 并且希望在尝试保存架构中未指定的属性时抛出错误,则可以将 strict
schema setting 设置为 'throw'
.
const mySchema = new Schema(
{
myField1: String,myField2: Number,},{ strict: 'throw' },);
这是我的邮递员,我在这里
如果您使用的是 mongoose 并且希望在尝试保存架构中未指定的属性时抛出错误,则可以将 strict
schema setting 设置为 'throw'
.
const mySchema = new Schema(
{
myField1: String,myField2: Number,},{ strict: 'throw' },);