Fill in your host, authentication, and options to get a clean, standard MongoDB URI. Supports standalone, replica set, sharded cluster, and DNS seedlist (SRV). Everything runs locally, so nothing is sent anywhere.
Almost every MongoDB driver and tool, from mongosh to Compass to your application code, connects using a connection string URI. This guide explains how a MongoDB URI is structured, what each part does, and which options you'll reach for most often.
A connection string is a single URL that tells a MongoDB driver where your database lives and how to connect to it, the servers, the credentials, and any connection options. Instead of configuring host, port and auth separately, you pass one string and the driver parses the rest.
mongodb://, the standard scheme. You list one or more host:port pairs explicitly. Used for standalone servers, replica sets, and sharded clusters.mongodb+srv://, the DNS seedlist scheme. You give a single hostname and MongoDB looks up the actual servers (and default options) from DNS SRV/TXT records. This is what MongoDB Atlas hands you, and TLS is enabled by default.mongodb://[username:password@]host1[:port1][,host2[:port2]...]/[database][?options]
mongodb://, the scheme (or mongodb+srv:// for DNS seedlist).username:password@, optional credentials. Special characters must be percent-encoded (this tool does that for you).host:port, one or more servers, comma-separated. The default port is 27017./database, the optional default (and default auth) database.?options, connection options as key=value pairs joined with &.mongodb://appUser:s3cret@db1.example.com:27017,db2.example.com:27017/shop?replicaSet=rs0&authSource=admin&tls=true
This connects to a two-member replica set rs0, authenticates user appUser against the admin database, selects the shop database, and requires TLS.
authSource, the database to authenticate against (often admin).authMechanism, SCRAM-SHA-256 (default), MONGODB-X509, PLAIN (LDAP), MONGODB-AWS, or GSSAPI.replicaSet, the replica-set name; required to connect as a set rather than to a single node.readPreference, primary (default), primaryPreferred, secondary, secondaryPreferred, or nearest.tls (a.k.a. ssl), enable encrypted connections.retryWrites / retryReads, automatically retry once on transient network errors (both default to true).w, write concern, e.g. majority.maxPoolSize / minPoolSize, connection-pool bounds (default 100 / 0).connectTimeoutMS / socketTimeoutMS / serverSelectionTimeoutMS, timeouts.compressors, wire compression (snappy, zlib, zstd).appName, an identifier that shows up in server logs and profiling.@, :, / or other special characters must be encoded, this builder handles it automatically.mongodb+srv:// keeps the string short and lets the cluster manage its own member list.27017. If your server listens on a different port, include it explicitly as host:port. (DNS seedlist URIs don't use an explicit port.)
mongodb:// lists servers explicitly; mongodb+srv:// takes a single hostname and resolves the member list and default options from DNS. Atlas provides the +srv form, and it enables TLS by default.
Yes. Characters like @, :, /, ? and # must be percent-encoded in the URI. This builder encodes the username and password for you.
Only when your user is defined in a database other than the one you're connecting to (commonly admin). The builder adds authSource only when it differs from MongoDB's default.
VisuaLeaf
Once your connection string is ready, VisuaLeaf turns it into a full workspace, browse collections, build queries and aggregations visually, design schemas, and chart your data. One modern client for MongoDB and SQL.