class Mongoid::PersistenceContext

def client

Returns:
  • (Mongo::Client) - The client for this persistence

Other tags:
    Example: Get the client for this persistence context. -
def client
  @client ||= begin
    client = Clients.with_name(client_name)
    options = client_options
    if database_name_option
      client = client.use(database_name)
      options = options.except(:database, 'database')
    end
    client = client.with(options) unless options.empty?
    client
  end
end