-
Type: Improvement
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: legacy-1.0.0-rc0
-
Component/s: API
-
Environment:All
ConnectionString::parse currently falls back to allowing an alternate internal mongodb connection format that can be parsed and considered valid by isValid() but do the wrong thing when connecting (which is surprising for the user).
An example of this is the following url:
localhost:1050,localhost:1055,localhost:1056/?replicaSet=rs-83d7523f-16cf-4246-8014-f1a6fa7ec264
It doesn't start with a mongodb:// so it's parsed in classic mode which creates the following observable behavior on the resulting connection string:
- isValid() returns true
- getServers() returns: replicaSet=rs-83d7523f-16cf-4246-8014-f1a6fa7ec264:27017 which is essentially the replica set portion
- getSetName returns: "localhost:1050,localhost:1055,localhost:1056" which is essentially the servers portion
- connect() fails with: "connect failed to replica set localhost:1050,localhost:1055,localhost:1056/?replicaSet=rs-83d7523f-16cf-4246-8014-f1a6fa7ec264:27017"
I am proposing that we split the functionality by having
- ConnectionString::parse accept only valid MongoDB connection strings
- Another parsing function to handle the odd deprecated internal format
We can also probably throw if there is no match in the new function now that we don't support the older version of the api.
- depends on
-
CXX-336 Remove Connection Pool
- Closed
- links to