Can't conecting Golang and MongoDB

I can’t run my project. I’ve been looking for the solution but still nothing works, can you guys help me? Here’s the error

@Valen_Rionald thanks for the question! The error

socket was unexpectedly closed: EOF

can be caused by many issues, but the most common is that TLS is not enabled. Make sure your connection string is using scheme mongodb+srv://, which enables TLS by default (mongodb:// scheme URIs do not enable TLS by default). Also make sure you’re not explicitly disabling TLS with option &tls=false or &ssl=false.

Can you post the connection string you’re using (with the username/password redacted)?

Here is the connection string

IP restriction is another cause for this kind of error. Go to your cluster and select network access in the security part. make sure you have at least your “current” IP in the list.

  • your IP will change on many occasions if not set as static. so check this always.

If this happens all the time, the network you are on (school, work) restricts you to use the required ports.

PS: be careful when sharing connection strings with passwords in them.