#Error connecting to MongoDB Atlas

15 messages · Page 1 of 1 (latest)

strong sphinx
#

Hello, I'm trying to connect to MongoDB Atlas via mongoose (npm:mongoose) but encountered the following error: ```
error: Uncaught MongoAPIError: Server record does not share hostname with parent URI
at resolveSRVRecord (file:///home/farish/.cache/deno/npm/registry.npmjs.org/mongodb/4.14.0/lib/connection_string.js:63:19)
at async file:///home/farish/.cache/deno/npm/registry.npmjs.org/mongodb/4.14.0/lib/mongo_client.js:123:31

My code: ```ts
import mongoose from 'npm:mongoose';

await mongoose.connect(
    'mongodb+srv://user:pass@main.pj9zc0r.mongodb.net/?retryWrites=true&w=majority',
);
#

I've added 0.0.0.0/0 to my network access

strong sphinx
#

Solved it

lethal fossil
#

hey @strong sphinx , what is the error did you ever face the error connection timed out when trying to connect with the mongodb

strong sphinx
#

but if im correct, it have to do with deno resolving dns and adding a . to the string

#

so in order to fix the error rewrite a mongodb dns resolver and check if the resolved dns have a . and remove if it does

#

to be honest im shocked that someone is still facing the same problem with me after several months

#

if you have any more problems, id be happy to help

lethal fossil
#

I haven't faced the same issue but it is similar to this issue, when I try to connect with the mongodb then it always shows the error: connection timed out.. but it is working correctly in node.

lethal fossil
#

and thank you for responding

gloomy knoll
#

@lethal fossil I have same "error: connection timed out.. but it is working correctly in node.", were you able to solve it?

lethal fossil
gloomy knoll
#

Ohh no party_deno 😄