We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have two models imported to ApplicationModule:
@Module({ imports: [ MongooseModule.forRoot(process.env.DB_URL), UsersModule, AuthModule ], controllers: [AppController], components: [] }) export class ApplicationModule {}
@Module({ imports: [ MongooseModule.forFeature([{ name: 'User', schema: UserSchema }]), forwardRef(() => AuthModule) ], components: [], controllers: [UsersController], exports: [] }) export class UsersModule { }
Inside the AuthModule I need to be able to access the UserSchema model, but im getting:
Error: Nest can't resolve dependencies of the AuthService (?). Please verify whether [0] argument is available in the current context.
when trying to use @InjectModel(UserSchema).
What am i missing?
The text was updated successfully, but these errors were encountered:
Hi @scopsy, You have to export this module as well:
MongooseModule.forFeature([{ name: 'User', schema: UserSchema }]),
Sorry, something went wrong.
@kamilmysliwiec That's what i ended doing. Thanks.
No branches or pull requests
I have two models imported to ApplicationModule:
Inside the AuthModule I need to be able to access the UserSchema model, but im getting:
when trying to use @InjectModel(UserSchema).
What am i missing?
The text was updated successfully, but these errors were encountered: