You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(mongodb): connection strings with several hosts (replica sets) are rejected or throw FormatException #1309
Uri.tryParse('mongodb://h1:27017,h2:27017/db?replicaSet=rs0') is null (the port segment is 27017,h2:27017), and Uri.parse throws. A host list is valid in the MongoDB URI format and is the normal form for replica sets.
New connection from URL (lib/features/connections/connection_url_parser.dart): Invalid URL/URI format.
Connector (lib/core/database/mongodb_connection.dart:92, 122, 188, 303): Uri.parse on the saved string throws FormatException in buildConnectionUri (SSH host override) and buildUriForDatabase (opening another database from the tree), so a replica-set connection saved through the form fails there.
With a mongodb+srv:// string and an SSH tunnel, replace(host: ..., port: ...) produces an SRV URI with a port, which is invalid.
Scope
A small URI splitter for the MongoDB scheme that keeps the host list as is (scheme, userinfo, hosts, path, query) for building and for the URL parser; no Uri.parse on a host list.
With an SSH tunnel, define what to do for several hosts (tunnel the first, or refuse with a clear message) and for +srv (refuse with a clear message).
Tests: parse, database switch and tunnel override for a multi-host string.
Acceptance
A multi-host URI imports from New connection from URL, and its first host and options are in the row.
Opening another database of a replica-set connection works.
+srv with a tunnel gives an explanation, not FormatException.
Activity
Merge pull request #1325 from QueryaHub/fix/1309-mongodb-multi-host
ZhuchkaTriplesix commentedon Oct 10, 2026
Сделано в #1325, смержено в dev.