Class Mongoid::Config::ReplsetDatabase
In: lib/mongoid/config/replset_database.rb
Parent: Hash

Methods

Public Class methods

Create the new db configuration class.

@example Initialize the class.

  Config::ReplsetDatabase.new(
    "hosts" => [[host1,port1],[host2,port2]]
  )

replSet does not supports auth

@param [ Hash ] options The configuration options.

@option options [ Array ] :hosts The database host. @option options [ String ] :database The database name. @option options [ Boolean ] :read_secondary Tells the driver to read from secondaries. …

@see Mongo::ReplSetConnection for all options

@since 2.0.0.rc.5

Public Instance methods

Do we need to authenticate against the database?

@example Are we authenticating?

  db.authenticating?

@return [ true, false ] True if auth is needed, false if not.

@since 2.0.2

Configure the database connections. This will return an array containing one Mongo::DB and nil (to keep compatibility with Mongoid::Config::Database) If you want the reads to go to a secondary node use the :read_secondary(true): option

@example Configure the connection.

  db.configure

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

@since 2.0.0.rc.5

Convenience for accessing the hash via dot notation.

@example Access a value in alternate syntax.

  db.host

@return [ Object ] The value in the hash.

@since 2.0.2

[Validate]