Module: Mongoo

Defined in:
lib/mongoo.rb,
lib/mongoo.rb,
lib/mongoo/base.rb,
lib/mongoo/core.rb,
lib/mongoo/cursor.rb,
lib/mongoo/hash_ext.rb,
lib/mongoo/changelog.rb,
lib/mongoo/modifiers.rb,
lib/mongoo/mongohash.rb,
lib/mongoo/persistence.rb,
lib/mongoo/describe_dsl.rb,
lib/mongoo/grid_fs/file.rb,
lib/mongoo/identity_map.rb,
lib/mongoo/embedded/base.rb,
lib/mongoo/grid_fs/files.rb,
lib/mongoo/attribute_proxy.rb,
lib/mongoo/attribute_sanitizer.rb,
lib/mongoo/embedded/core_mixin.rb,
lib/mongoo/embedded/hash_proxy.rb,
lib/mongoo/embedded/array_proxy.rb,
lib/mongoo/grid_fs/describe_dsl.rb,
lib/mongoo/embedded/describe_dsl.rb,
lib/mongoo/attributes/describe_dsl.rb

Overview

Mongoo.conn = lambda { Mongo::Connection.new(“localhost”, 27017, :pool_size => 5, :timeout => 5) } Mongoo.db = “mydb” Mongoo.conn => #<Mongo::Connection:0x00000100db8ac0>

Defined Under Namespace

Modules: Attributes, Changelog, Embedded, GridFs, HashExt, Modifiers, Persistence Classes: AlreadyInsertedError, AttributeProxy, AttributeSanitizer, Base, ConnNotSet, Core, Cursor, DbNameNotSet, DescribeDsl, DuplicateKeyError, IdentityMap, InsertError, InvalidAttributeValue, ModifierBuilder, ModifierUpdateError, Mongohash, MongooException, NotInsertedError, NotValidError, RemoveError, StaleUpdateError, UnknownAttributeError, UpdateError

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.verbose_debugObject

Returns the value of attribute verbose_debug.



11
12
13
# File 'lib/mongoo.rb', line 11

def verbose_debug
  @verbose_debug
end

Class Method Details

.async?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/mongoo.rb', line 34

def async?
  Mongo.async?
end

.connObject



26
27
28
# File 'lib/mongoo.rb', line 26

def conn
  @_conn ||= (@conn_lambda && @conn_lambda.call)
end

.conn=(conn_lambda) ⇒ Object



13
14
15
16
17
18
# File 'lib/mongoo.rb', line 13

def conn=(conn_lambda)
  @conn_lambda = conn_lambda
  @_conn = nil
  @_db = nil
  @conn_lambda
end

.dbObject



30
31
32
# File 'lib/mongoo.rb', line 30

def db
  @_db ||= (conn && conn.db(@db_name))
end

.db=(db_name) ⇒ Object



20
21
22
23
24
# File 'lib/mongoo.rb', line 20

def db=(db_name)
  @db_name = db_name
  @_db = nil
  @db_name
end