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

Support auth params in Mongo::MongoReplicaSetClient.from_uri

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.9.0
    • Affects Version/s: 1.8.5
    • Component/s: Replica Set

      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.

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

              Created:
              Updated:
              Resolved: