My credentials work perfectly with Robomongo but I can\'t make the connection with node.js
I have tried to make the connection using ssh2 and tunnel-ssh npm module and f
As mscdex mentioned ssh2 isn't a good module to use to make an ssh tunnel connection to a database. tunnel-ssh is more appropriate.
Here are the configuration options I've used :
dstPort: remote database connection port
localPort: same as dstPort, It'll be the port you'll use for your local machine
username: SSH username,
host: SSH address
dstHost: database connection url (...mongodbns.com) ,
privateKey: SSH key
Then once your tunnel is connected connect via mongoose to your localhost such as mondodb://localhost:27000 (use the localport you defined in localPort)
var server = tunnel(config, function (error, server) {
if(error){
console.log("SSH connection error: " + error);
}
mongoose.connect('mongodb://localhost:27000/');
//...rest of mongoose connection
}