Major - P3
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.
- 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 
- 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.
RUBY-608 Unauthorized db error when using Mongo::MongoClient.from_uri when connecting to a replica set