OverwriteModelError: Cannot overwrite `Company` model once compiled.
at NativeConnection.Connection.model (C:\Users\meebo\WebstormProjects\nest-demo\node_modules\mongoose\lib\connection.js:1214:13)
at InstanceWrapper.metatype (C:\Users\meebo\WebstormProjects\nest-demo\node_modules\kindagoose\src\utils\model-factory.ts:49:47)
at Injector.instantiateClass (C:\Users\meebo\WebstormProjects\nest-demo\node_modules\@nestjs\core\injector\injector.js:354:55)
at callback (C:\Users\meebo\WebstormProjects\nest-demo\node_modules\@nestjs\core\injector\injector.js:56:45)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at Injector.resolveConstructorParams (C:\Users\meebo\WebstormProjects\nest-demo\node_modules\@nestjs\core\injector\injector.js:136:24)
at Injector.loadInstance (C:\Users\meebo\WebstormProjects\nest-demo\node_modules\@nestjs\core\injector\injector.js:61:13)
at Injector.loadProvider (C:\Users\meebo\WebstormProjects\nest-demo\node_modules\@nestjs\core\injector\injector.js:88:9)
at C:\Users\meebo\WebstormProjects\nest-demo\node_modules\@nestjs\core\injector\instance-loader.js:56:13
at async Promise.all (index 3)
Description
Application crashes of the mongoose error when the same schema is registered twice or more.
Code:
Error: