Hi guys,
Trying to connect n8n to a MongoDB Atlas instance. Atlas provides connection strings which do not have a port if you select a connection string with Node 3 or later. For earlier versions of the Node driver, it does include a URL of the form you’re using (hostname:port), HOWEVER, it has three different URLs and the example code to connect appears to require all three:
var MongoClient = require('mongodb').MongoClient;
var uri = "mongodb:// **user** : **<password>** @cluster-shard-*.mongodb.net:27017,cluster-shard-*.mongodb.net:27017,cluster-shard-*.mongodb.net:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true&w=majority";
MongoClient.connect(uri, function(err, client) {
const collection = client.db("test").collection("devices");
// perform actions on the collection object
client.close();
});
I looked at n8n’s MongoDB node and see you only support a single URL. Any insights on how to connect to Atlas using the existing MongoDB node? Perhaps I am missing something?
In any case, I’d suggest giving an option to let someone pass in a connection string. You might consider this for all of your DB nodes as many DBs are easily configured with a connection string.
Thanks!