From c2154834e153c9540ca347315c6578a995f536c4 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Wed, 7 Jul 2021 12:01:29 -0400 Subject: [PATCH] fix(mongo_client): allow calling `db()` before MongoClient is connected --- src/mongo_client.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/mongo_client.ts b/src/mongo_client.ts index 34ec5b56ed..e2cc996711 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);