Thank you for continuing to follow up with me, but I have found a fix for it already. It turns out the ISP that I was using had some firewall configuration that did not allow me to connect to the cluster. So I outsourced the job of connecting to the cluster to a GitHub action where it’s ISP had no such issues.
I came to the conclusion after reading this → Error: couldn't connect to server 127.0.0.1:27017 - #16 by Stennie_X
specifically, this part
- Your connection from client to server is blocked by firewall or network configuration
As for my pymongo version, it is 4.6.0
The error message was as follows
SSL handshake failed: <shard_id>.mongodb.net:27017: [WinError 10054] An existing connection was forcibly closed by the remote host (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms)
Thank you for your time