에 MissingSchemaError id로 이벤트 하나를 찾고 sport
host
및 players
필드를 채 웁니다. 처음 두 필드는 채우고 잘 작동 할 때 오류를 발생시키지 않지만 문제는 players
필드입니다.몽구스 나는 두 몽구스 모델을 가지고 인구
const event = await Event.findById(eventId)
.populate('sport', 'host', 'players')
.exec();
내가 잘못하고있는 무슨에 어떤 생각 : 나는 .populate()
메소드를 호출하고있어 어떻게이 마지막으로
{ MissingSchemaError: Schema hasn't been registered for model "players".
Use mongoose.model(name, schema)
at MissingSchemaError (/Users/elias/Documents/tfg/sporter-app/sporter-api/node_modules/mongoose/lib/error/missingSchema.js:20:11)
at NativeConnection.Connection.model (/Users/elias/Documents/tfg/sporter-app/sporter-api/node_modules/mongoose/lib/connection.js:1043:11)
at getModelsMapForPopulate (/Users/elias/Documents/tfg/sporter-app/sporter-api/node_modules/mongoose/lib/model.js:3569:20)
at populate (/Users/elias/Documents/tfg/sporter-app/sporter-api/node_modules/mongoose/lib/model.js:3113:15)
at _populate (/Users/elias/Documents/tfg/sporter-app/sporter-api/node_modules/mongoose/lib/model.js:3081:5)
at Function.Model.populate (/Users/elias/Documents/tfg/sporter-app/sporter-api/node_modules/mongoose/lib/model.js:3041:5)
at Immediate.<anonymous> (/Users/elias/Documents/tfg/sporter-app/sporter-api/node_modules/mongoose/lib/query.js:1441:17)
at Immediate.<anonymous> (/Users/elias/Documents/tfg/sporter-app/sporter-api/node_modules/mquery/lib/utils.js:137:16)
at runCallback (timers.js:781:20)
at tryOnImmediate (timers.js:743:5)
at processImmediate [as _immediateCallback] (timers.js:714:5)
message: 'Schema hasn\'t been registered for model "players".\nUse mongoose.model(name, schema)',
name: 'MissingSchemaError' }
: 그것은이 오류가 발생합니다? 감사!