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 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:
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:
| Option | Type | Default | Description |
|---|---|---|---|
| retryWrites | boolean | true | Enable retryable writes for transient network errors. |
| w | string | number | "majority" | Write concern. Controls acknowledgement of write operations. |
| maxPoolSize | number | 100 | Maximum number of connections in the connection pool. |
| connectTimeoutMS | number | 30000 | Timeout in milliseconds for establishing a connection. |
| authSource | string | "admin" | Database used for authentication when credentials are provided. |
| replicaSet | string | - | Name of the replica set to connect to. |
| tls | boolean | false | Enable TLS/SSL for the connection. |
| readPreference | string | "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 Atlas (SRV)
Connect to a MongoDB Atlas cluster with authentication and retryable writes:
Replica Set
Connect to a three-node replica set with TLS enabled:
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