Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-606

Support auth params in Mongo::MongoReplicaSetClient.from_uri

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 1.8.5
    • Fix Version/s: 1.9.0
    • Component/s: Replica Set
    • Labels:

      Description

      I'm uncertain if this is a bug or by design, but when connecting to a replica set with the from_uri method, the auth parameters are not set. As a result, any attempt to read/write with the connection will fail with unauthorized.

      To repro:

      1. dbconn: mongodb://usr:pswd@host1,host2,host3/dbname?replicaSet=rs_name&readPreference=secondaryPreferred

      client = Mongo::MongoReplicaSetClient.from_uri(dbconn)

      print client.auths.to_json # prints []

      1. check count() or any other operation on a collection via this connection results in unauthorized error since no credentials set

      Workaround is to call client.add_auth(db,usr,pswd) after connecting

      If not a replica set, "auths" are set.

      Documentation for MongoReplicaSetClient shows from_uri as a supported method which has led to some confusion since it doesn't seem to be fully supported.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              brandon.black@10gen.com Brandon Black
              Reporter:
              michael.arlt Michael Arlt
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: