I'm using compose.io for hosting test and production mongodb databases and am attempting to connect through a node app using mongoose.js (which uses the standard nodejs mongodb driver under the hood). My connection options are as follows:
var connectionString = 'mongodb://user:password@host1:port1,host2:port2/dbname?ssl=true';
var options = {
mongos: true,
server: {
ssl: true,
sslValidate: true,
sslCA: [fs.readFileSync('/path/to/cert/certificate.pem')] // cert from compose.io dashboard
}
}
mongoose.createConnection(connectionString, options);
The connection just seems to hang, though. I don't receive an error from the server, nor do I receive an 'open' event.
ANSWER
I was able to fix the issue by moving all of the options from
server
intomongos
: