Skip to content

Commit 51ea86d

Browse files
authored
fix(NODE-3417): allow calling db() before MongoClient is connected (#2889)
1 parent 7aa3008 commit 51ea86d

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

src/mongo_client.ts

-7
Original file line numberDiff line numberDiff line change
@@ -473,13 +473,6 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> {
473473
// Copy the options and add out internal override of the not shared flag
474474
const finalOptions = Object.assign({}, this[kOptions], options);
475475

476-
// If no topology throw an error message
477-
if (!this.topology) {
478-
throw new MongoDriverError(
479-
'MongoClient must be connected before calling MongoClient.prototype.db'
480-
);
481-
}
482-
483476
// Return the db object
484477
const db = new Db(this, dbName, finalOptions);
485478

0 commit comments

Comments
 (0)