I am trying to connect my PYQT5 app to MongoDB my account is setup with the IP set correctly my code in my file looks like this.
from pymongo import MongoClient, DESCENDING
import certifi
cluster = MongoClient("mongodb+srv://TestDB:<xxxxxx>@cluster0.8axfw.mongodb.net/DATABASENAME?retryWrites=true&w=majority")
db = cluster["game"] # select the database ...
collection = db["leaderboard"] # this will be created if it doesn't exist!
# add a new score
x = {"id": 0, "user_name": "Leeeeroy Jenkins", "score": 124, "time": "11/24/2014 13:43:22"}
collection.insert_one(x)
I was having trouble earlier with different pip/ conda installations I needed to install but I have gotten passed that and now wen I run my code this error is printed.
Can someone please help me? I have been searching for a while here and on stack but nothing has fixed this error.
It does look like your connection is attempted but is failing due to a timeout based off the error noted in the title.
From the client that is failing to connect, please try performing the initial basic network connectivity tests and provide the output for the cluster you are having trouble connecting to:
/// example
telnet cluster0-shard-00-00.ze4cx.mongodb.net 27017
Note: You can find the hostname in the metrics page of your cluster
I would also try connecting using mongosh from the same client hosting the PYQT5 application you mentioned. If this also fails to connect, please provide the output from the connection attempt.