Closed rakshitweb closed 5 months ago
Can you post the code you're trying to run to connect to the document DB?
` const mongoose = require('mongoose'); const dotenv = require('dotenv'); dotenv.config();
const DBConnect = () => mongoose.connect(process.env.DB_URL, { tls: true, tlsCAFile: 'global-bundle.pem', directConnection: true });
module.exports = DBConnect; `
DB_URL: mongodb://USERNAME>:<PASSWORD>@<CLUSTER_NAME:
And how are you importing and running DBConnect() ?
@rakshitweb Is this a protected DB? Because in that case you will also need to add password to the url connection string, otherwise you won't be to connect to it
@rakshitweb https://www.mongodb.com/docs/manual/reference/connection-string/ here you have some more information about mongodb connection strings if you need it
Prerequisites
Mongoose version
^8.0.2
Node.js version
20.9.0
MongoDB version
5.0.0
Operating system
Windows
Operating system version (i.e. 20.04, 11.3, 10)
10
Issue
I am not able to connect to document DB using mongoose. I am able to connect to the same using mongo shell, and compass.
Getting this error: Failed to connect with Mongo DB MongooseServerSelectionError: connect ETIMEDOUT