我有像这样的猫鼬模式:
var subtopicSchema = new schema({
name:String
})
var topicSchema = new schema({
name:String,
subtobpics:[subtopicSchema]
});
var subjectSchema = new schema({
name:String,
topics:[topicSchema]
})
var courseSchema = new schema({
name:{type:String,unique:true},
subjects:[subjectSchema]
});
然后我正在使用这样的“unique validator plugin”:
courseSchema.plugin(uniqueValidator, { message: 'unique' });
所以这就是我想要实现的目标:
所以问题是:当前的设置是否适用于上述四个要求?
如果是,为什么?
如果没有,怎么样?