i have installed mongodb (1.8.3) on two seperate servers and set them up to use “replica sets” as found here: http://www.mongodb.org/display/DOCS/Replica+Set+Tutorial
everything looks good so far: one server is recognized as primary, one as secondary (when i access them via commandline).
the problem is that i can’t connect to the DB using node.js
(0.4.10) and mongoose (2.1.0) like this:
var mongo = require('mongoose'); mongo.connectSet('mongodb://host/dbname,mongodb://host2/dbname');
i always get the following error message:
TypeError: Cannot read property 'reconnectWait' of undefined at new (/var/www/node/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connections/repl_set_servers.js:23:31) at NativeConnection.doOpenSet (/var/www/node/node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js:80:18) at NativeConnection.openSet (/var/www/node/node_modules/mongoose/lib/connection.js:252:8) at Mongoose.connectSet (/var/www/node/node_modules/mongoose/lib/index.js:116:27) ...
searched around a bit and found a post somewhere saying that i also have to supply the name of the replica set – so i tried this instead:
what am i doing wrong here …?!
Problem courtesy of: Philipp Kyeck