# File lib/mongoid/config/replset_database.rb, line 16 def configure # yes, construction is weird but the driver wants # "A list of host-port pairs ending with a hash containing any options" # mongo likes symbols options = self.inject({ :logger => Mongoid::Logger.new }) do |memo, (k, v)| memo[k.to_sym] = v memo end connection = Mongo::ReplSetConnection.new(*(hosts.clone << options)) if authenticating? connection.add_auth(database, username, password) connection.apply_saved_authentication end [ connection.db(database), nil ] end