Class Mongoid::Config::Database
In: lib/mongoid/config/database.rb
Parent: Hash

This class handles the configuration and initialization of a mongodb database from options.

Methods

configure   new  

Constants

PRIVATE_OPTIONS = %w(uri database username password logger)   keys to remove from self to not pass through to Mongo::Connection

Public Class methods

Create the new db configuration class.

@example Initialize the class.

  Config::Database.new(
    false, "uri" => { "mongodb://durran:password@localhost:27017/mongoid" }
  )

@param [ Hash ] options The configuration options.

@option options [ String ] :database The database name. @option options [ String ] :host The database host. @option options [ String ] :password The password for authentication. @option options [ Integer ] :port The port for the database. @option options [ String ] :uri The uri for the database. @option options [ String ] :username The user for authentication.

@since 2.0.0.rc.1

Public Instance methods

Configure the database connections. This will return an array containing the master and an array of slaves.

@example Configure the connection.

  db.configure

@return [ Array<Mongo::DB, Array<Mongo:DB>> ] The Mongo databases.

@since 2.0.0.rc.1

[Validate]