[DRIVERS-566] Allow replicaSet=1 in MongoDB URLs Created: 04/Sep/18 Updated: 07/Dec/18 Resolved: 01/Oct/18 |
|
| Status: | Closed |
| Project: | Drivers |
| Component/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Henrik Ingo (Inactive) | Assignee: | Bernie Hackett |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Description |
|
Relevant documentation: https://docs.mongodb.com/manual/reference/connection-string/#replica-set-option To tell a driver to connect to a list of nodes as a replicaset - such as when I want to use transactions - I need to use replicaSet=myrs option in the MongoDB URL, where "myrs" is the name of the replicaset. For easily copypasteable examples, it's unfortunate that there is no meaningful default value for the replica set name. For example, I can assume that on most people's laptops, this URL will work:
However, this probably won't:
I would like to have the option to say "this is a replica set but I don't care about the name". As a strawman suggestion, using 1 for true (and 0 for false) I could:
|
| Comments |
| Comment by Bernie Hackett [ 01/Oct/18 ] |
|
I don't think we want to do this. The replSet option is in part a way for the application to ensure they are connecting to the correct set. Adding a "any replica set will do" option is better handled by passing two set members in the seed list, which the Java driver will treat as a replica set. I do think we should make the topology type discovery mechanism consistent between drivers. |
| Comment by Bernie Hackett [ 05/Sep/18 ] |
|
The SDAM spec has this to say about the initial topology type:
So the behavior is undefined and the behavior you're describing isn't correct for all drivers. Rather than add a special value for replicaSet it probably makes more sense to more strictly define how drivers discover initial topology. For example, having all drivers follow the behavior of the Java driver documented in the spec. |