Skip to content

Commit 811f8f8

Browse files
committed
fix(connect): use reported default databse from new uri parser
1 parent 94fd6d8 commit 811f8f8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/operations/mongo_client_ops.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -555,23 +555,29 @@ function transformUrlOptions(_object) {
555555
object[i] = auth[i];
556556
}
557557
}
558+
558559
if (auth.username) {
559560
object.auth = auth;
560561
object.user = auth.username;
561562
}
562-
if (auth.db) {
563-
object.dbName = auth.db;
564-
}
565563
}
564+
565+
if (_object.defaultDatabase) {
566+
object.dbName = _object.defaultDatabase;
567+
}
568+
566569
if (object.maxpoolsize) {
567570
object.poolSize = object.maxpoolsize;
568571
}
572+
569573
if (object.readconcernlevel) {
570574
object.readConcern = { level: object.readconcernlevel };
571575
}
576+
572577
if (object.wtimeoutms) {
573578
object.wtimeout = object.wtimeoutms;
574579
}
580+
575581
return object;
576582
}
577583

0 commit comments

Comments
 (0)