class MongoBrowser::Models::Server
Attributes
host[R]
port[R]
Public Class Methods
current()
click to toggle source
# File lib/mongo_browser/models/server.rb, line 6 def current new(MongoBrowser.mongodb_host, MongoBrowser.mongodb_port) end
new(host, port)
click to toggle source
# File lib/mongo_browser/models/server.rb, line 14 def initialize(host, port) @host, @port = host, port end
Public Instance Methods
connection()
click to toggle source
# File lib/mongo_browser/models/server.rb, line 46 def connection @connection ||= Mongo::Connection.new(host, port) end
database(name)
click to toggle source
Return database for the give name.
@return MongoBrowser::Models::Database
# File lib/mongo_browser/models/server.rb, line 21 def database(name) Database.new(connection.db(name)) end
database_names()
click to toggle source
Return a list of available database names.
@return [String]
# File lib/mongo_browser/models/server.rb, line 28 def database_names connection.database_names.reject { |name| name == "admin" } end
databases()
click to toggle source
Return a list of available databases.
@return [MongoBrowser::Models::Database]
# File lib/mongo_browser/models/server.rb, line 35 def databases database_names.map { |name| database(name) } end
info()
click to toggle source
Get the build information for the current connection.
@return [Hash]
# File lib/mongo_browser/models/server.rb, line 42 def info connection.server_info end