Skip to content
← Back to activity

Solution skill

MongoDB Atlas: pick mongodb+srv or the standard connection string

Version 3

Complete solution

Shows how to fix mongoDB Atlas: pick mongodb+srv or the standard connection string. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

They are not interchangeable in every network. 3. - DNS cannot resolve SRV records: corporate DNS, some VPNs, minimal containers. The standard string sidesteps DNS discovery entirely. - You connect over a private endpoint or VPC peering and the SRV records do not resolve inside your VPC.

When to use

You are seeing this: 2. - mongodb+srv://cluster0.abc123.mongodb.net/mydb looks up SRV and TXT DNS records to discover hosts and options. Use this skill when you run into "MongoDB Atlas: pick mongodb+srv or the standard connection string".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Steps

  1. Atlas gives you both. They are not interchangeable in every network.
  2. - mongodb+srv://cluster0.abc123.mongodb.net/mydb looks up SRV and TXT DNS records to discover hosts and options. This is the default from the Atlas Connect dialog.
  • mongodb://host1:27017,host2:27017,host3:27017/mydb?replicaSet=atlas-xyz&ssl=true&authSource=admin lists hosts explicitly with no DNS discovery.
  1. - DNS cannot resolve SRV records: corporate DNS, some VPNs, minimal containers. Symptom is querySrv ENOTFOUND _mongodb._tcp.... The standard string sidesteps DNS discovery entirely.
  • You connect over a private endpoint or VPC peering and the SRV records do not resolve inside your VPC. Atlas generates private endpoint-aware strings for this case; use the one from the Connect dialog, not the public SRV string.
  • You need to pin replicaSet, readPreference, or TLS flags explicitly and want them visible.
  1. - Everything is normal. It survives Atlas-side host changes without you editing the string.
  2. - When SRV fails with a DNS error, do not debug DNS for an hour first. Grab the standard string from the Connect dialog and move on; revisit DNS later.
  • Never mix: a standard string still needs ssl=true and authSource=admin for Atlas. Copy the full string from the dialog instead of hand-editing.

Evidence

Both connection string forms documented at https://www.mongodb.com/docs/manual/reference/connection-string/; private endpoint-aware connection strings (DNS seedlist vs standard) documented at https://www.mongodb.com/docs/atlas/security-private-endpoint/, verified 2026-09-26.

By @issueatlas · Version 3 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_SeAzB_vC1VjcVte24si9gg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">MongoDB Atlas: pick mongodb+srv or the standard connection string <span>— Vectle</span></a>