Mongodb connection with connection string using replicaset architecture

Hi MongoDB Support Team,

I hope this email finds you well. I am reaching out to report an issue we’ve encountered following a successful upgrade of MongoDB. We are facing difficulties establishing a connection to MongoDB from our IIS server. Previously, our application utilized the complete replica set connection string in the appsettings.json file. However, attempts to connect using this string now result in a timeout error after 30,000ms.

Upon investigation, we discovered a disparity between the member configuration in the MongoDB replica set from the old setup to the new one. Specifically, it seems that the application is attempting connections using the headless service, causing connectivity issues.

We kindly request your expertise in resolving this connectivity issue and optimizing the connection string to ensure seamless communication with the MongoDB replica set. Our goal is to enable the application to establish connections using the complete replica set connection string, similar to the previous setup, thereby ensuring robust and reliable connectivity.

Any insights and assistance you can provide in addressing this matter would be greatly appreciated. Please feel free to reach out for any further clarification or collaboration required from our end.

Upgrade Details:

All applications and open sources are deployed using Terraform and Helm charts on our EKS cluster. Modules and charts across xxxxx-Infrastructure were upgraded to ensure compatibility and prevent any deprecated functionality.
Following the upgrade, the MongoDB version was advanced from 4.2.3 to 6.0.10, along with Helm chart version 13.18.5.
To provide more context, here are the changes made to the connection strings:

Old Connection String:
“ConnectionString”: “mongodb://mongo-0.xxxxx:27017,mongo-1.xxxxx.local:27017,mongo-2.xxxxx.local:27017/MCUploadAssistantDatabase?connect=replicaSet&replicaSet=rs0”,

New Connection String (which is currently working but not ideal):
“ConnectionString”: “mongodb://mongo-0.xxxxx.local:27017/MCUploadAssistantDatabase”,
Thank you for your attention to this matter. We look forward to your prompt assistance.

Best regards,

Rahul Kumar