MongoDB Connection

Question:
So basicly everytime i try to connect to my MongoDB it gives error, it was working perfectly last week.

I saw its my code issue that’s why MongoDB is not connecting but no!
I used my pc localhost to connect and it works fine!
Repl link:

code snippet

There’s already a topic for this, I think.

1 Like

They say they fixed it, but i have this issue right now.

can you send the error details and an actual repl link?

I’m not a mongo db expert, so I may not be able to help you, but errors will be useful

It’s basically a timeout, I’m facing the same issue.

const timeoutError = new error_1.MongoServerSelectionError(Server selection timed out after ${serverSelectionTimeoutMS} ms, this.description);
^

MongoServerSelectionError: getaddrinfo ENOTFOUND x-california-shard-00-00.3mos8.mongodb.net

I found a solution just add maxPoolSize for connections

client = pymongo.MongoClient(
f"mongodb+srv://{username}:{password}@{your_project}.ot2td1y.mongodb.net/?cretiers…",
maxPoolSize=1000
)

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.