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

Support auth params in Mongo::MongoReplicaSetClient.from_uri

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 1.8.5
    • 1.9.0
    • Replica Set

    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

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

              Dates

                Created:
                Updated:
                Resolved: