Skip to content

feat: MongoDB replica set multi-host connections#866

Merged
datlechin merged 24 commits intomainfrom
feat/mongodb-multi-host
Apr 25, 2026
Merged

feat: MongoDB replica set multi-host connections#866
datlechin merged 24 commits intomainfrom
feat/mongodb-multi-host

Conversation

@datlechin
Copy link
Copy Markdown
Collaborator

Summary

  • Add multi-host connection support for MongoDB replica sets (closes MongoDB replica set: no support for multiple hosts #854)
  • New HostListFieldRow UI component with add/remove host:port rows in the connection form
  • New FieldType.hostList and FieldSection.connection in PluginKit for generic multi-host field support
  • Custom URL parser for multi-host MongoDB URIs (mongodb://h1:27017,h2:27017,h3:27017/db)
  • Backward compatible: existing single-host connections auto-migrate in the form

Changes

PluginKitFieldType.hostList, FieldSection.connection (no ABI bump needed)

MongoDB PluginmongoHosts field, URI builder handles comma-separated hosts, driver prefers mongoHosts from additionalFields

Connection FormHostListFieldRow multi-row editor, host/port derived from first entry on save, legacy connection migration on load, SSH + multi-host warning

URL ParserparseMultiHostMongoDB() for proper authority parsing without URLComponents, multiHost field on ParsedConnectionURL

DisplayhostDisplayString on DatabaseConnection shows host1:27017 (+2 more) for multi-host

Docs — Replica Set / Multi-Host section in docs/databases/mongodb.mdx

Test plan

  • Create new MongoDB connection with single host — verify host/port fields work as before
  • Add multiple hosts via "Add Host" button — verify all entries saved
  • Remove hosts — verify minimum 1 row enforced
  • Save multi-host connection — verify primary host/port derived from first entry
  • Edit existing single-host MongoDB connection — verify mongoHosts synthesized from host:port
  • Import URL mongodb://h1:27017,h2:27017,h3:27017/db?replicaSet=myrs — verify all hosts populated
  • Import URL mongodb://user:pass@host1:27017/db — verify single host works
  • Import URL mongodb+srv://cluster.mongodb.net/db — verify SRV still works (no multi-host path)
  • Verify welcome screen shows host1:27017 (+2 more) for multi-host connections
  • Enable SSH with multi-host — verify warning message appears
  • Test connection with multi-host — verify connection succeeds
  • Switch database type away from MongoDB and back — verify form resets correctly

@datlechin datlechin merged commit eb7e29a into main Apr 25, 2026
2 checks passed
@datlechin datlechin deleted the feat/mongodb-multi-host branch April 25, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MongoDB replica set: no support for multiple hosts

1 participant