How do I connect to Amazon's new DocumentBD database from node.js (In this case, using an out-of-the-box Elastic Beanstalk setup.)
This is my code, copied from the docs (with some values altered for privacy). It just times out and the eventual value of 'err' is 'true'. What did I miss? How can I get a better error?
var MongoClient = require('mongodb').MongoClient,fs = require('fs');
var ca = [fs.readFileSync("rds-combined-ca-bundle.pem")];
var connection_string = "mongodb://USERNAME:PASSWORD@docdb-2019-04-23-12-55-44.cluster-abcdefghij.eu-west-1.docdb.amazonaws.com:27017/?ssl=true&&replicaSet=rs0&readPreference=secondaryPreferred";
MongoClient.connect(
connection_string, {
sslValidate: true,
sslCA: ca,
useNewUrlParser: true
},
function (err,client) {
console.log(err+" , "+ client);
});
Here's hoping somebody knows.