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) {