For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

Connection Strings

You can use connection strings to define connections between MongoDB instances and the following destinations:

To connect to your cluster, you can use one of these connection string formats:

  • SRV connection strings use the mongodb+srv:// prefix to simplify connecting to a cluster. SRV connection strings automatically include all seed list hosts, which supports server rotation without client reconfiguration. When possible, use SRV connection strings over standard connection strings.

  • Standard connection strings use the mongodb:// prefix and require you to include all cluster members in replica sets and sharded clusters.

Use the selectors at the top of the page to choose your deployment type and connection string format. Complete the following steps to find your connection string.

For a full list of connection string options, see Connection String Options.

On this page