const ClazzSchema = new Schema({
name: String,//班级名称,初一二班
school: {
type: ObjectId,
ref: 'School'
},//学校字段做冗余,方便查询
virtual: Boolean,//是否为虚拟班级
type: Number,//1理科,2文科,3艺体
upgrade: {
type: ObjectId,
ref: 'Clazz'
},//升级方向
subClazz: {
type: String,
ref: 'Clazz'
},//当前绑定的虚拟绑架
parentClazz: {
type: ObjectId,
ref: 'Clazz'
},//绑定的实体班级,虚拟班级失效后,该字段不删除
grade: {
type: ObjectId,
ref: 'Grade'
},
status: Boolean,
createdAt: Date,
updatedAt: Date
});
模型设计如上,通过clazz,在populate(‘subClazz’),都没有发射查询语句,google之有说type换成string或是this的,但是我都没有试成功