MongoDB
MongoDB mode proxies replica-set connections. Waypoint exposes one listener port per member, rewrites the topology hosts in hello / isMaster responses ✓ TestRewriteTopology_ReplicaSet internal/mongowire/topology_test.go:35 ✓ TestTopologyRewriter_RewritesTopology internal/mongowire/rewrite_test.go:24 , and authenticates clients as scoped backend users. ✓ TestIntegration_MongoProxy_ReplicaSetWithAuth internal/proxy/mongo_integration_test.go:921
Two ways to enumerate members
Section titled “Two ways to enumerate members”SRV discovery
Section titled “SRV discovery”For SRV-backed clusters (most managed offerings), omit members and let Waypoint resolve the SRV record at startup, then bind consecutive ports starting at listen: ✓ TestMaterializeMongoSRVBackends internal/server/server_test.go:329 ✓ TestExpandedBackends_WithMongoDBMembers internal/config/config_test.go:1338
[[listeners]]name = "mongo-prod"listen = ":27017"mode = "mongodb"backend_via_tailscale = truetls = truetls_mode = "require"
[listeners.mongodb]admin_user = "waypoint_admin"admin_password = "${MONGO_ADMIN_PASSWORD}"auth_database = "admin"replica_set = "rs0"srv = "cluster.example.com" # resolves _mongodb._tcp.cluster.example.comsrv_max_members = 3 # binds :27017, :27018, :27019When combining SRV discovery with a Tailscale Service, set advertise so topology rewrites can be built before service listeners are registered.
Explicit members
Section titled “Explicit members”When you need fixed addresses (e.g. self-hosted clusters), map members explicitly:
[[listeners]]name = "mongo-prod"mode = "mongodb"backend_via_tailscale = true
[listeners.mongodb]admin_user = "waypoint_admin"admin_password = "${MONGO_ADMIN_PASSWORD}"auth_database = "admin"replica_set = "rs0"
[[listeners.mongodb.members]]backend = "mongo1.prod.internal:27017"listen = ":27017"advertise = "waypoint-db:27017"
[[listeners.mongodb.members]]backend = "mongo2.prod.internal:27017"listen = ":27018"advertise = "waypoint-db:27018"
[[listeners.mongodb.members]]backend = "mongo3.prod.internal:27017"listen = ":27019"advertise = "waypoint-db:27019"advertise is the host:port Waypoint substitutes into topology responses so that drivers reconnect through the proxy, not directly to the backend member. ✓ TestBuildMongoTopologyMap internal/server/server_test.go:306
Provisioning modes
Section titled “Provisioning modes”mode = "database" (default)
Section titled “mode = "database" (default)”Waypoint uses admin_user / admin_password to create and update scoped MongoDB users on the backend, following the same identity-derived naming as Postgres.
[listeners.mongodb.provision]mode = "database"mode = "static" (Atlas-compatible)
Section titled “mode = "static" (Atlas-compatible)”For MongoDB Atlas — or any cluster where user-management commands are not available — static mode picks from a pre-created set of backend users you configure.
[listeners.mongodb.provision]mode = "static"
[[listeners.mongodb.provision.static_users]]name = "app-readwrite"username = "atlas_app_rw"password = "${MONGO_APP_RW_PASSWORD}"auth_database = "admin"database = "app"permissions = ["readwrite"]
[[listeners.mongodb.provision.static_users]]name = "readonly"username = "atlas_readonly"password = "${MONGO_READONLY_PASSWORD}"auth_database = "admin"permissions = ["readonly"] # matches any all-readonly grant setThe matching rules:
- When
databaseis set, Waypoint matches the exact expanded database role set the grant resolves to. ✓TestMongoStaticCredentialMatchesDatabasePresetinternal/proxy/mongodb_static_test.go:32 ✓TestIntegration_MongoProxy_StaticUserReadWriteAllowedinternal/proxy/mongo_integration_test.go:272 - When only
permissionsis set, it matches grants where every database has that same preset. ✓TestMongoStaticCredentialMatchesPermissionOnlyUserinternal/proxy/mongodb_static_test.go:65 Mixed-preset grants do not match permission-only users. ✓TestMongoStaticCredentialRejectsMixedPermissionOnlyUserinternal/proxy/mongodb_static_test.go:101 - When multiple users could match, the more permissive set wins (e.g.
readwritebeatsreadonly). ✓TestMongoStaticCredentialReadWriteWinsOverReadonlyGrantinternal/proxy/mongodb_static_test.go:134 - Configure only the static users you want to allow. If a grant has no matching static user, Waypoint returns an authentication error to the client and does not connect to the backend. ✓
TestMongoStaticMissingCredentialReturnsClientMessageinternal/proxy/mongodb_static_test.go:198 ✓TestIntegration_MongoProxy_StaticUserMissingReturnsClientMessageinternal/proxy/mongo_integration_test.go:385
Static users must already have the matching roles in MongoDB or Atlas — Waypoint does not create or modify them.
TLS and SNI rewrite
Section titled “TLS and SNI rewrite”Set tls = true for backend TLS, and tls_mode (off / optional / require) for client-facing TLS. See TLS for certificate selection.
When MongoDB clients connect with TLS+SNI, Waypoint rewrites topology hostnames to the SNI hostname (preserving the advertised ports). ✓ TestMongoTopologySNIRewritesAdvertiseHostAndPreservesPorts internal/proxy/mongodb_tls_test.go:131 This keeps drivers pinned to the proxy across reconnects. ✓ TestIntegration_MongoProxy_ReplicaSetTopologyRewrite internal/proxy/mongo_integration_test.go:813