christkv/node-mongodb-native — Issue #489: Recovering from catastrophic replicaset failure
Author: mjhnyc
Created: 2012-01-27 21:39:34+00:00
State: open

I am implementing a replicaset (master, arbiter, secondary) using auto_reconnect and have discovered a few issues related to a complete failure, where there is no master database available in the replicaset.

This happens both when the application executes `db.open()` and there is no database available, and also happens when the database dies after a successful connection and a reconnect is attempted. In both cases, even when the database comes online again, the application never reconnects, but appears to be stuck in an endless loop; the `db.open()` callback function is never executed.

I am using MongoDB v2.0.2 and driver v.0.9.8.3

I notice in *connection/server.js* there are several cases where the following code should be setting the state to 'disconnected' but is not due to using a comparison operator.

```javascript
// Set server state to disconnected
server._serverState == 'disconnected';
```

I corrected those, but I am still having the problem.