From f361220450971fb3fc6894b9eaff65a89c6fa1c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B7=98=E5=B0=8F=E6=9D=B0?= <308512341@qq.com> Date: Fri, 17 Dec 2021 11:31:37 +0800 Subject: [PATCH] Update connection.js --- lib/connection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/connection.js b/lib/connection.js index 8ba8f32b248..670a98426b9 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -1359,7 +1359,7 @@ Connection.prototype.setClient = function setClient(client) { if (!(client instanceof mongodb.MongoClient)) { throw new MongooseError('Must call `setClient()` with an instance of MongoClient'); } - if (this.client != null || this.readyState !== STATES.disconnected) { + if (this.readyState !== STATES.disconnected) { throw new MongooseError('Cannot call `setClient()` on a connection that is already connected.'); } if (client.topology == null) {