-
-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection error #206
Comments
Try to connect using URI |
I did and got the same error message. |
There is a problem with the domain name resolution. Are you sure your domain name is correct? Can you connect through other client tools? |
I connect with Mongoose on Node.js using the full URI without issues. When I use either the full URI or the more detailed method here, I can't connect. |
host should only contains cluster0.gpkxo.mongodb.net |
Tried it. It still didn’t work. I also tried with and without the Mongo protocol and still could not connect. |
I don't know what you tried and whether you constructed the parameters correctly. Just believe that you did the right thing. By the way, can your domain name be resolved successfully through |
I can connect with Mongoose, MongoDB Compass, and Node.js MongoDB driver with the URI. I cannot connect with this library. |
That is the URI MongoDB Atlas gives me. Everything, except this driver, that I use to connect to it works: "mongo+srv://garrigaj:[email protected]/db_name?retryWrites=true&w=majority" |
What made it possible for me to connect via URI is adding the "authMechanism" param exactly like shown below. I also added it to the docs here a few weeks ago.
|
Hello 🙂 |
Thanks! This worked perfectly 💜 |
Just for the record. I was also facing this issue and adding the |
I am getting this error when I try to connect:
error: Uncaught (in promise) Error: MongoError: "Connection failed: Invalid hostname: 'cluster0.gpkxo.mongodb.net?retryWrites=true&w=majority'"
throw new MongoError(
Connection failed: ${e.message || e}
);^
at MongoClient.connect (https://deno.land/x/[email protected]/src/client.ts:93:15)
at async MongoDBConnector._makeConnection (https://deno.land/x/[email protected]/lib/connectors/mongodb-connector.ts:44:7)
at async MongoDBConnector.query (https://deno.land/x/[email protected]/lib/connectors/mongodb-connector.ts:65:5)
at async Database.query (https://deno.land/x/[email protected]/lib/database.ts:240:21)
at async Function.createTable (https://deno.land/x/[email protected]/lib/model.ts:172:5)
at async Database.sync (https://deno.land/x/[email protected]/lib/database.ts:210:7)
I used the code example from the home page:
db: 'todo-app',
tls: true,
servers: [
{
host: 'cluster0.gpkxo.mongodb.net?retryWrites=true&w=majority',
port: 27017,
},
],
credential: {
username: '<my_username>',
password: '<my_password>',
db: 'todo-app',
mechanism: 'SCRAM-SHA-1',
},
I also verified that the password was available by resetting and I made sure I had whitelisted my IP address.
The text was updated successfully, but these errors were encountered: