I have gone through the documentation and have tried hundreds of combinations for the connection string. I am using mongoose to connect by the way. The code looks along the lines of this, with sensitive information in CAPS.
const mongoose = require("mongoose")
mongoose.connect("mongodb+srv://USER:PASS@NAME.mo6orid.net/test", {
useNewUrlParser: true,
useUnifiedTopology: true,
}).then(async () => {
....
}).catch((err) => {
...
})
This is one of the first API's that I have legitimately tried to integrate into my code, so please be understanding that this issue isn't making any sense to me. I am able to connect locally with linux using mongosh "mongodb+srv://USER:PASS@NAME.mo6orid.net/test"
, along with the integrated VSCode MongoDB environment (which gives me a connection string that is exactly the same as the one I am entering).
The error that I receive:
MongoDB Error: querySrv ETIMEOUT _mongodb._tcp.NAME.mo6orid.mongodb.net
I have ran through the MongoDB setup and documentation and I have my IP whitelisted and credentials set. I have also tried various different methods for connecting in my program above, but to no avail. I have tried adding various options to the uri, but nothing seems to be working. At one point I wondered whether there was some sort of system permissions issue that would cause this, but running the program as a super user or admin doesn't change anything either. At this point I am kind of lost and believe it could be a port issue, but honestly I'm not sure. If any further information is needed to diagnose this, please let me know. If anyone familiar with MongoDB can point me in the right direction, then it would be greatly appreciated.