module Mongoid

A class which sends values to the database as Strings but returns them to the user as Symbols.

Constants

MONGODB_VERSION

The minimum MongoDB version supported.

PLATFORM_DETAILS

A string added to the platform details of Ruby driver client handshake documents.

@since 6.1.0

VERSION

Public Instance Methods

client(name) click to toggle source

Convenience method for getting a named client.

@example Get a named client.

Mongoid.client(:default)

@return [ Mongo::Client ] The named client.

@since 5.0.0

# File lib/mongoid.rb, line 103
def client(name)
  Clients.with_name(name)
end
configure() { |Config| ... } click to toggle source

Sets the Mongoid configuration options. Best used by passing a block.

@example Set up configuration options.

Mongoid.configure do |config|
  config.connect_to("mongoid_test")

  config.clients.default = {
    hosts: ["localhost:27017"],
    database: "mongoid_test",
  }
end

@return [ Config ] The configuration object.

@since 1.0.0

# File lib/mongoid.rb, line 67
def configure
  block_given? ? yield(Config) : Config
end
default_client() click to toggle source

Convenience method for getting the default client.

@example Get the default client.

Mongoid.default_client

@return [ Mongo::Client ] The default client.

@since 5.0.0

# File lib/mongoid.rb, line 79
def default_client
  Clients.default
end
disconnect_clients() click to toggle source

Disconnect all active clients.

@example Disconnect all active clients.

Mongoid.disconnect_clients

@return [ true ] True.

@since 5.0.0

# File lib/mongoid.rb, line 91
def disconnect_clients
  Clients.disconnect
end