From ba2667ea9ffd0952dacd489feaba5b11fcded623 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Fri, 16 Jul 2021 15:50:53 -0400 Subject: [PATCH] fix(NODE-3417): allow calling `db()` before MongoClient is connected (#2889) --- src/mongo_client.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/mongo_client.ts b/src/mongo_client.ts index 4053584c62a..57653cbe481 100644 --- a/src/mongo_client.ts +++ b/src/mongo_client.ts @@ -473,13 +473,6 @@ export class MongoClient extends TypedEventEmitter { // Copy the options and add out internal override of the not shared flag const finalOptions = Object.assign({}, this[kOptions], options); - // If no topology throw an error message - if (!this.topology) { - throw new MongoDriverError( - 'MongoClient must be connected before calling MongoClient.prototype.db' - ); - } - // Return the db object const db = new Db(this, dbName, finalOptions);