Mongoose through ssh tunnel.
npm install --save mongoose-ssh
const mongoose = require('mongoose-ssh');
mongoose.connect(
{
host: 'ssh-server-host',
port: 'ssh-server-port',
dstHost: 'destination-host',
dstPort: 'destination-port',
localHost: 'local-host',
localPort: 'local-port',
username: 'ssh-username',
privateKey: 'ssh-private-key'
},
'mongodb://dbUsernam:dbPassword@localhost/dbname'
);
See test.js
for more details.
MIT