You can use connection strings to define connections between MongoDB instances and the following destinations:
Your applications when you connect using drivers.
Tools such as MongoDB Compass and MongoDB Shell (mongosh).
MongoDB can use one of two connection string formats:
SRV connection strings use the
mongodb+srv://prefix and provide a simplified way to connect to a cluster. SRV connection strings automatically include all the seed list hosts, which can change the servers in rotation without requiring client reconfiguration. When possible, use SRV connection strings instead of the standard connection string format.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.
Learn More
For a full list of connection string options, see Connection String Options.
For more connection string examples, see: