Mongodb always uses "test" as database name since 0.2.25
See original GitHub issueIssue type:
[ ] question [x] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[x] mongodb
[ ] mssql
[ ] mysql
/ mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[x] latest
(0.2.25)
[ ] @next
[ ] 0.x.x
(or put your version here)
Steps to reproduce or a small repository showing the problem:
When updating to the 0.2.25 (from 0.2.24), typeorm now always uses the database named ‘test’ instead of what is passed in the options when using mongodb.
Downgrading to 0.2.24 makes it work again.
We are using "@nestjs/typeorm": "^7.0.0"
.
With the debugger we can see that the option is correct:
From what I can see, it’s simply always using the default database name, taken from node_modules\mongodb\lib\core\uri_parser.js
:
line 673:
if (result.auth && result.auth.db) {
result.defaultDatabase = result.auth.db;
} else {
result.defaultDatabase = 'test';
}
replacing test with another value will give me that value as database name.
Version 0.2.24 has no such issue.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Yes, I can repro when updating to 0.2.25. I wish I had a minimal repro but sadly don’t have much time right now. 😞 I’m guessing that any nestjs application using mongodb should trigger this though.
Let me know if the issue persists - however, as I can’t replicate it with 0.2.26 & 0.2.27 I think we’re good to go here!