Method: Mongo::Connection#apply_saved_authentication

Defined in:
lib/jmongo/connection.rb

#apply_saved_authenticationBoolean

Apply each of the saved database authentications.

Returns:

  • (Boolean)

    returns true if authentications exist and succeeed, false if none exists.

Raises:



84
85
86
87
88
89
90
# File 'lib/jmongo/connection.rb', line 84

def apply_saved_authentication
  return false if @auths.empty?
  @auths.each do |auth|
    self[auth['db_name']].authenticate(auth['username'], auth['password'], false)
  end
  true
end