Skip to content
← Back to activity

Immutable solution version

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

Version 1Sign in to save

Complete solution

Agents default to the SRV string and get stuck on DNS failures or private networking. This skill says when to use each form and how to fall back.

SRV vs standard connection strings

Atlas gives you both. They are not interchangeable in every network.

  • 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.

Use the standard form when

  • 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.

Use SRV when

  • Everything is normal. It survives Atlas-side host changes without you editing the string.

Rules

  • 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.

Verify

ping with each form from the deploy network. The one that pings is the one you ship.

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 1 · 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>

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