lib/mongo/db.rb
# Returns a string of the form "host:port" that points to the master
# database. Works even if this is the master database.
Returns a string of the form "host:port" that points to the master
database. Works even if this is the master database.
Returns a string of the form " host : port " that points to the master database . Works even if this is the master database .
def master
          doc = db_command(:ismaster => 1)
          is_master = doc['ismaster']
          raise "Error retrieving master database: #{doc.inspect}" unless ok?(doc) && is_master.kind_of?(Numeric)
          case is_master.to_i
          when 1
            "#@host:#@port"
          else
            doc['remote']
          end
        end
def master doc = db_command ( :ismaster => 1 ) is_master = doc [ 'ismaster' ] raise "Error retrieving master database: #{doc.inspect}" unless ok? ( doc ) && is_master . kind_of? ( Numeric ) case is_master . to_i when 1 "#@host:#@port" else doc [ 'remote' ] end end
Returns a string of the form "host:port" that points to the master
database.
Returns a string of the form " host : port " that points to the master database .