christkv/node-mongodb-native — Issue #455: Connection.isOpen returns true even though it might have no open connections
Author: lassus
Created: 2011-12-20 16:12:31+00:00
State: open

ConnectionPool.prototype.isConnected = function() {
// return this.connections.length > 0;
return this._poolState !== 'disconnected';
}

in ConnectionPool.prototype.start = function()
this._poolState = 'connecting';

but the connection isn't connected until later in _connect in connection.on("connected") .. handler.

as a consequence server.isConnected returns true but dB.collection(...) fails.

possible solution:

in said handler perhaps set poolState to connected and use that in the reply. Either after one open connection or
after all are opended. And change isConnected to reflect the state.