Mention model name in missing virtual option in getModelsMapForPopulate
#13406
Labels
developer-experience
This issue improves error messages, debugging, or reporting
Milestone
Prerequisites
Issue
Currently the error below does not mention the model name, and the stacktrace is all just
node_modules/mongoose
, making it hard to find which model is causing a problemmongoose/lib/helpers/populate/getModelsMapForPopulate.js
Line 392 in c1c3dfe
example:
/mnt/projects/nodejs/typegoose-testing/node_modules/mongoose/lib/helpers/populate/getModelsMapForPopulate.js:392 return new MongooseError('If you are populating a virtual, you must set the ' + ^ MongooseError: If you are populating a virtual, you must set the localField and foreignField options at _virtualPopulate (/mnt/projects/nodejs/typegoose-testing/node_modules/mongoose/lib/helpers/populate/getModelsMapForPopulate.js:392:14) at getModelsMapForPopulate (/mnt/projects/nodejs/typegoose-testing/node_modules/mongoose/lib/helpers/populate/getModelsMapForPopulate.js:42:12) at populate (/mnt/projects/nodejs/typegoose-testing/node_modules/mongoose/lib/model.js:4186:21) at _populate (/mnt/projects/nodejs/typegoose-testing/node_modules/mongoose/lib/model.js:4146:5) at /mnt/projects/nodejs/typegoose-testing/node_modules/mongoose/lib/model.js:4118:5 at new Promise (<anonymous>) at Function.populate (/mnt/projects/nodejs/typegoose-testing/node_modules/mongoose/lib/model.js:4117:10) at /mnt/projects/nodejs/typegoose-testing/node_modules/mongoose/lib/query.js:2465:11 at /mnt/projects/nodejs/typegoose-testing/node_modules/mongoose/lib/query.js:3080:21 at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
The text was updated successfully, but these errors were encountered: