Uploaded image for project: 'Drivers'
  1. Drivers
  2. DRIVERS-566

Allow replicaSet=1 in MongoDB URLs

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • None

    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:

      mongodb://localhost:2017/test
      

      However, this probably won't:

      mongodb://localhost:2017/test?replicaSet=replset
      

      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:

      mongodb://localhost:2017/test?replicaSet=1
      

      Attachments

        Activity

          People

            bernie@mongodb.com Bernie Hackett
            henrik.ingo@mongodb.com Henrik Ingo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: