Method: Mongo::Connection#add_auth
- Defined in:
- lib/jmongo/connection.rb
#add_auth(db_name, username, password) ⇒ Hash
Save an authentication to this connection. When connecting, the connection will attempt to re-authenticate on every db specificed in the list of auths. This method is called automatically by DB#authenticate.
102 103 104 105 106 107 108 109 110 |
# File 'lib/jmongo/connection.rb', line 102 def add_auth(db_name, username, password) remove_auth(db_name) auth = {} auth['db_name'] = db_name auth['username'] = username auth['password'] = password @auths << auth auth end |