I'm trying to connect to my shared MongoDB cluster, but I keep receiving the following error: SSL handshake failed: ac-ascvkib-shard-00-02.hkzvmvh.mongodb.net:27017: [WinError 10054] An existing connection was forcibly closed by the remote host.
The exact code I'm using is below:
from pymongo.mongo_client import MongoClient# I replaced <password> with my own passworduri = "mongodb+srv://admin:<password>@cluster0.hkzvmvh.mongodb.net/?retryWrites=true&w=majority"# Create a new client and connect to the serverclient = MongoClient(uri)# Send a ping to confirm a successful connectiontry: client.admin.command('ping') print("Pinged your deployment. You successfully connected to MongoDB!")except Exception as e: print(e)
I'm using Python 3.11 and I'm using pymongo==3.11. I'm on a windows machine, and it seems that the error message gets printed multiple times.