-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: MongoDB 3.2
-
Labels:
-
Environment:ReplicaSet - Master + Secondary + Arbiter
Master + Arbiter - up and running ok
Secondary - down
-
Empty show more show less
Using older versions of node and npm when install mongodb you have different versions:
npm install mongodb- node 0.10.38 - 2.1.22-alpha4
npm install mongodb- node 4.4.5 - 2.1.21
On mongodb alpha versions we have a bug when a replica set member is down(in this example the SEC).
var CONNECTION_URL = 'mongodb://' + [MASTER, SECONDARY].join(',') + '/' + DB;
If the connection url have the master and the secondary the process will crash with this error:
d:\test\node_modules\mongodb\lib\server.js:231
process.nextTick(function()Unknown macro: { throw err; })
^
TypeError: Cannot read property 'hosts' of null
at connectFunction (d:\test\node_modules\mongodb\lib\mongo_client.js:327:23)
at open (d:\test\node_modules\mongodb\lib\db.js:242:14)
at Server.connect.connectErrorHandler (d:\test\node_modules\mongodb\lib\server.js:229:9)
at g (events.js:180:16)
at emit (events.js:98:17)
at reconnectErrorHandler (d:\test\node_modules\mongodb\node_modules\mongodb-core\lib\topologies\server.js:138:12)
at g (events.js:180:16)
at emit (events.js:98:17)
at errorHandler (d:\test\node_modules\mongodb\node_modules\mongodb-core\lib\connection\pool.js:126:12)
at g (events.js:180:16)
If the connection url have only reacheable members, everything is ok.
.var CONNECTION_URL = 'mongodb://' + MASTER + '/' + DB;
I've attached the code.
The question is why on older npm's is installed mongodb alpha?