Skip to content
This repository was archived by the owner on Feb 4, 2022. It is now read-only.

Commit 645d6df

Browse files
vkarpov15mbroadst
authored andcommitted
fix(cursor): check for autoReconnect option only for single server
1 parent be98e0b commit 645d6df

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/cursor.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,9 @@ var nextFunction = function(self, callback) {
575575
// Topology is not connected, save the call in the provided store to be
576576
// Executed at some point when the handler deems it's reconnected
577577
if (!self.topology.isConnected(self.options)) {
578-
if (!self.cursorState.reconnect) {
578+
// Only need this for single server, because repl sets and mongos
579+
// will always continue trying to reconnect
580+
if (self.topology._type === 'server' && !self.topology.s.options.reconnect) {
579581
// Reconnect is disabled, so we'll never reconnect
580582
return callback(new MongoError('no connection available'));
581583
}

0 commit comments

Comments
 (0)