[CXX-316] Handle MongoDB connection string format differently than legacy format Created: 26/Aug/14 Updated: 23/Oct/14 Resolved: 07/Oct/14 |
|
| Status: | Closed |
| Project: | C++ Driver |
| Component/s: | API |
| Affects Version/s: | legacy-1.0.0-rc0 |
| Fix Version/s: | legacy-1.0.0-rc1 |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Tyler Brock | Assignee: | Samantha Ritter (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | legacy-cxx | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
All |
||
| Issue Links: |
|
||||||||
| Description |
|
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:
I am proposing that we split the functionality by having
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. |
| Comments |
| Comment by Githook User [ 07/Oct/14 ] | |||||
|
Author: {u'username': u'samantharitter', u'name': u'Samantha Ritter', u'email': u'samantha.ritter@10gen.com'}Message: | |||||
| Comment by Samantha Ritter (Inactive) [ 10/Sep/14 ] | |||||
| Comment by Tyler Brock [ 27/Aug/14 ] | |||||
|
Hey Samantha. Failure is expected but not encountered, which is why this needs to change. The code works because it finds a slash in the MongoDB URI. However, the parameters to ConnectionString are flipped. In the proprietary format the set name is on the left and servers on the right, the MongoConnection string has the servers on the left and the params (like set name) on the right so it winds up building a connection string with {{ (?ReplicaSet=XXX)}} as the servers and the server list (member1:port,member2:port...) as the replica set name (when its the list if servers):
The result is that it appears to work (isValid() returns true) but it builds a connection string with the wrong information and can't connect. |