How to inject model if the model is in the root module only
You have to additionally import your schemas with MongooseModule.forFeature
. Usually, you would set up the database connection in the root module and then import the schemas in dedicated feature modules. This is why the imports are separate.
MongooseModule.forFeature([{ name: 'Folder', schema: FolderSchema }])
For further information, see the mongo docs.