Module: Mongoid
Overview
Top-level module for project.
Constant Summary
-
MONGODB_VERSION =
# File 'lib/mongoid.rb', line 54
The minimum MongoDB version supported.
"2.6.0" -
PLATFORM_DETAILS =
# File 'lib/mongoid.rb', line 51
A string added to the platform details of Ruby driver client handshake documents.
"mongoid-#{VERSION}".freeze
-
VERSION =
# File 'lib/mongoid/version.rb', line 8
The current version of
MongoidNote that this file is automatically updated via ‘rake candidate:create`. Manual changes to this file will be overwritten by that rake task.
'9.0.2'
Class Attribute Summary
GlobalDiscriminatorKeyAssignment - Extended
| discriminator_key= | Sets the global discriminator key name. |
::Mongoid::Clients::Sessions::ClassMethods - Extended
| in_transaction? | This method should be used to detect whether a persistence operation is executed inside transaction or not. |
Loadable - Extended
| ignore_patterns | Returns the array of glob patterns that determine whether a given path should be ignored by the model loader. |
| ignore_patterns= | Sets the ignore patterns to the given array of patterns. |
| model_paths | Returns the array of paths where the application’s model definitions are located. |
| model_paths= | Sets the model paths to the given array of paths. |
Loggable - Extended
Class Method Summary
Deprecable - Extended
| deprecate | Declares method(s) as deprecated. |
::Mongoid::Clients::Sessions::ClassMethods - Extended
| after_commit | Sets up a callback is called after a commit of a transaction. |
| after_create_commit | Shortcut for after_commit |
| after_destroy_commit | Shortcut for after_commit |
| after_rollback | This callback is called after a create, update, or destroy are rolled back. |
| after_save_commit | Shortcut for after_commit |
| after_update_commit | Shortcut for after_commit |
| transaction | Executes a block within the context of a transaction. |
| with_session | Execute a block within the context of a session. |
| _session, | |
| assert_valid_transaction_action | Asserts that the given actions are valid for after_commit and after_rollback callbacks. |
| run_abort_callbacks | Runs after_rollback callbacks on modified documents. |
| run_commit_callbacks | Runs after_commit callbacks on modified documents. |
| set_options_for_callbacks! | Transforms custom options for after_commit and after_rollback callbacks into options for |
| transaction_include_any_action?, | |
| transactions_not_supported_exceptions | Driver version 2.20 introduced a new exception for reporting that transactions are not supported. |
Loadable - Extended
| files_under_path | Given a single path, returns all ruby files under that path (or, if |
| files_under_paths | Given a list of paths, return all ruby files under that path (or, if |
| ignored? | Returns true if the given file path matches any of the ignore patterns. |
| load_model | A convenience method for loading a model’s file. |
| load_models | Search a list of model paths to get every model and require it, so that indexing and inheritance work in both development and production with the same results. |
Loggable - Extended
| default_logger | Gets the default |
| rails_logger |
Instance Method Summary
-
#client(name) ⇒ Mongo::Client
Convenience method for getting a named client.
-
#configure(&block) ⇒ Config
Sets the
Mongoidconfiguration options. -
#default_client ⇒ Mongo::Client
Convenience method for getting the default client.
-
#disconnect_clients ⇒ true
Disconnect all active clients.
-
#persistence_context
Internal use only
Internal use only
Define persistence context that is used when a transaction method is called on
Mongoidmodule. -
RawValue(*args) ⇒ Mongoid::RawValue
Instantiates a new
RawValueobject. -
#reconnect_clients ⇒ true
Reconnect all active clients.
-
#storage_options
Internal use only
Internal use only
Define client that is used when a transaction method is called on
Mongoidmodule.
Instance Method Details
#client(name) ⇒ Mongo::Client
Convenience method for getting a named client.
#configure(&block) ⇒ Config
Sets the Mongoid configuration options. Best used by passing a block.
#default_client ⇒ Mongo::Client
Convenience method for getting the default client.
#disconnect_clients ⇒ true
Disconnect all active clients.
# File 'lib/mongoid.rb', line 99
def disconnect_clients Clients.disconnect end
#persistence_context
Define persistence context that is used when a transaction method is called on Mongoid module.
# File 'lib/mongoid.rb', line 134
def persistence_context PersistenceContext.get(Mongoid) || PersistenceContext.new(Mongoid) end
RawValue(*args) ⇒ Mongoid::RawValue
Instantiates a new ::Mongoid::RawValue object. Used as a syntax shortcut.
#reconnect_clients ⇒ true
Reconnect all active clients.
#storage_options
Define client that is used when a transaction method is called on Mongoid module. This MUST be the default client.
# File 'lib/mongoid.rb', line 142
def { client: :default } end