#Need Help for connection MongoDB to NestJs using TypeORM
1 messages · Page 1 of 1 (latest)
Need Help for connection MongoDB to NestJs use TypeORM
Need Help for connection MongoDB to NestJs using TypeORM
your user don't have permissions
I have just check connection to DB is success but when I still get this error. Can you give me any idea
you use atlas or self hosted?
I am using self hosted
ok,you have config authentication?
How to configure it. I am new to Nestjs
My code at app.module.ts
@Module({
imports: [
ConfigModule.forRoot(),
TypeOrmModule.forRootAsync({
useFactory: () => ({
type: 'mongodb',
host: process.env.DB_HOST,
port: parseInt(process.env.DB_PORT) || 20117,
username: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
autoLoadEntities: true,
authSource: 'admin',
entities: [__dirname + '/**/entities/*.entity{.ts,.js}'],
synchronize: true,
}),
}),
ZaloModule,
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
Please, could you show me where it is wrong?
In your machine where you have the database I mean....
It's connect db is success but when I access via: http://localhost:3000/zalo that I received this error
you can show zaloService
you can read this: https://stackoverflow.com/questions/57848302/how-to-solve-command-find-requires-authentication-using-node-js-and-mongoose