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

Commit

Permalink
fix(cursor): check for autoReconnect option only for single server
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 authored and mbroadst committed Jan 10, 2018
1 parent be98e0b commit 645d6df
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/cursor.js
Expand Up @@ -575,7 +575,9 @@ var nextFunction = function(self, callback) {
// Topology is not connected, save the call in the provided store to be
// Executed at some point when the handler deems it's reconnected
if (!self.topology.isConnected(self.options)) {
if (!self.cursorState.reconnect) {
// Only need this for single server, because repl sets and mongos
// will always continue trying to reconnect
if (self.topology._type === 'server' && !self.topology.s.options.reconnect) {
// Reconnect is disabled, so we'll never reconnect
return callback(new MongoError('no connection available'));
}
Expand Down

0 comments on commit 645d6df

Please sign in to comment.