Hi,
Please help, I want to connect to the Document Db connected over AWS,
For this, I need to connect the Database of the Meteor App to the cluster first
But I am using the following code, but not able to connect
Meteor.startup(function () {
var url = process.env.MONGO_URL;
//Specify the Amazon DocumentDB cert
var ca = [Assets.getText("rds-combined-ca-bundle.pem")];
var url =
'mongodb://projectname:projectpassword@docdb-2020-08-06-06-54-39.cluster-ca4iwkkg1okk.ap-south-1.docdb.amazonaws.com:27017/oyi?ssl=true&replicaSet=rs0&readPreference=secondaryPreferred';
MongoDB.connect(url, {
sslValidate: true,
sslCA:ca,
useNewUrlParser: true
}, function(err, db) {
if (err) {
throw err;
}
//console.log(db);
db.collectionNames(function(err, items) {
if (err) {
throw err;
}
console.log(items);
});
});
});
Not sure what the issue and they way I am using the pem file is the right way or not, or Is there any other method then please help