我正在使用猫鼬在rest API中与mongoDB进行交互, 并且在使用区分符时,出现此错误:
名称为“ serviceMember”的鉴别器已经存在
知道使用此代码,一切都很好:
const serviceManagerSchema = new Schema({
serviceId : {
type : Schema.Types.ObjectId,
ref : 'service'
},
serviceMembers : [{
type : Schema.Types.ObjectId,
ref : 'serviceMember'
}]
},options)
const ServiceManager = Employee.discriminator('serviceManager',serviceManagerSchema)
但这不起作用
const serviceMemberSchema = new Schema({
},options)
const ServiceMember = Employee.discriminator('serviceMember',serviceMemberSchema)
module.exports = ServiceMember
我尝试用另一个我确定从未使用过的名称替换“ serviceMember”名称,但仍然是相同的错误
请帮助我,谢谢您