lib/mongo/db.rb
# Returns true if this database is a master (or is not paired with any
# other database), false if it is a slave.
Returns true if this database is a master (or is not paired with any
other database), false if it is a slave.
Returns true if this database is a master ( or is not paired with any other database ) false if it is a slave .
def master?
          doc = db_command(:ismaster => 1)
          is_master = doc['ismaster']
          ok?(doc) && is_master.kind_of?(Numeric) && is_master.to_i == 1
        end
def master? doc = db_command ( :ismaster => 1 ) is_master = doc [ 'ismaster' ] ok? ( doc ) && is_master . kind_of? ( Numeric ) && is_master . to_i == 1 end
Returns true if this database is a master (or is not paired with any
other database), false if it is a slave.
Returns true if this database is a master ( or is not paired with any other database ) false if it is a slave .