Description
Issue type:
[x] question
[] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ] cordova
[X] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[] latest
[ ] @next
[x] 0.3.12 (or put your version here)
HI, I have tried to connect atlas mongdb in nestjs. here is my app.module.ts
TypeOrmModule.forRootAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: async (
config: ConfigService
): Promise<TypeOrmModuleOptions> => {
const url = `mongodb+srv://${config.get("MONGODB_USER")}:${config.get("MONGODB_PASSWORD_ENCODED")}@${config.get("MONGODB_URL")}/${config.get("MONGODB_DBNAME")}`;
return {
type: "mongodb",
url: url,
entities: [EventEntity],
synchronize: true,
useNewUrlParser: true,
useUnifiedTopology: true,
logging: true,
};
},
}),
Special characters are included in password so encoded password are given by config module.
Unfortunately, i got authentication failed error
MongoError: Authentication failed.
I think this decodeURIComponent in DriverUtils.parseMongoDBConnectionUrl makes this happen.
typeorm/src/driver/DriverUtils.ts
Line 286 in 58fc088
when i change this line as
password: password, //decodeURIComponent(password),
then connection successes