MongoDB Connection String Builder

Build your MongoDB connection URI visually. Configure host, port, authentication, SSL, replica sets, and additional options — then copy the ready-to-use string.

No additional options. Click "Add" to include custom query parameters.

Connection String

mongodb://localhost

MongoDB Connection String Format

A MongoDB connection string (also called a connection URI) is the standard way to tell drivers and tools how to connect to your database. The format follows the URI specification and encodes the hostname, credentials, database name, and connection preferences in a single string.

The general structure is:

mongodb://[username:password@]host[:port][/database][?options]

For MongoDB Atlas and other hosted services that use DNS seed lists, the mongodb+srv:// protocol is used instead. This resolves the hostname via DNS SRV records, which means you do not need to specify a port or multiple hosts manually.

Common Connection Options

Connection options are appended as query parameters after the database name. Here are the most commonly used options:

OptionTypeDefaultDescription
retryWritesbooleantrueEnable retryable writes for transient network errors.
wstring | number"majority"Write concern. Controls acknowledgement of write operations.
maxPoolSizenumber100Maximum number of connections in the connection pool.
connectTimeoutMSnumber30000Timeout in milliseconds for establishing a connection.
authSourcestring"admin"Database used for authentication when credentials are provided.
replicaSetstring-Name of the replica set to connect to.
tlsbooleanfalseEnable TLS/SSL for the connection.
readPreferencestring"primary"How reads are routed to replica set members (primary, secondary, nearest, etc.).

Examples

Local Development

Connect to a MongoDB instance running on your machine with default settings:

mongodb://localhost:27017/myapp

MongoDB Atlas (SRV)

Connect to a MongoDB Atlas cluster with authentication and retryable writes:

mongodb+srv://admin:[email protected]/production?retryWrites=true&w=majority

Replica Set

Connect to a three-node replica set with TLS enabled:

mongodb://dbuser:[email protected]:27017,mongo2.example.com:27017,mongo3.example.com:27017/mydb?replicaSet=rs0&tls=true

Manage MongoDB visually with Mongon

Paste your connection string into Mongon and start browsing collections, navigating relations, and building queries — all in a native macOS app.

Download Mongon