Module: Mongoid
- Extended by:
- Forwardable, Mongoid, Clients::Sessions::ClassMethods, Deprecable, GlobalDiscriminatorKeyAssignment, Loadable, Loggable
- Included in:
- Mongoid
- Defined in:
- lib/mongoid.rb,
lib/mongoid/utils.rb,
lib/mongoid/atomic.rb,
lib/mongoid/config.rb,
lib/mongoid/fields.rb,
lib/mongoid/clients.rb,
lib/mongoid/factory.rb,
lib/mongoid/matcher.rb,
lib/mongoid/version.rb,
lib/mongoid/copyable.rb,
lib/mongoid/criteria.rb,
lib/mongoid/document.rb,
lib/mongoid/equality.rb,
lib/mongoid/findable.rb,
lib/mongoid/loadable.rb,
lib/mongoid/loggable.rb,
lib/mongoid/scopable.rb,
lib/mongoid/stateful.rb,
lib/mongoid/threaded.rb,
lib/mongoid/warnings.rb,
lib/mongoid/cacheable.rb,
lib/mongoid/evolvable.rb,
lib/mongoid/indexable.rb,
lib/mongoid/matchable.rb,
lib/mongoid/shardable.rb,
lib/mongoid/touchable.rb,
lib/mongoid/attributes.rb,
lib/mongoid/changeable.rb,
lib/mongoid/composable.rb,
lib/mongoid/contextual.rb,
lib/mongoid/deprecable.rb,
lib/mongoid/matcher/eq.rb,
lib/mongoid/matcher/gt.rb,
lib/mongoid/matcher/in.rb,
lib/mongoid/matcher/lt.rb,
lib/mongoid/matcher/ne.rb,
lib/mongoid/matcher/or.rb,
lib/mongoid/positional.rb,
lib/mongoid/reloadable.rb,
lib/mongoid/selectable.rb,
lib/mongoid/timestamps.rb,
lib/mongoid/association.rb,
lib/mongoid/deprecation.rb,
lib/mongoid/encryptable.rb,
lib/mongoid/matcher/all.rb,
lib/mongoid/matcher/and.rb,
lib/mongoid/matcher/gte.rb,
lib/mongoid/matcher/lte.rb,
lib/mongoid/matcher/mod.rb,
lib/mongoid/matcher/nin.rb,
lib/mongoid/matcher/nor.rb,
lib/mongoid/matcher/not.rb,
lib/mongoid/persistable.rb,
lib/mongoid/traversable.rb,
lib/mongoid/validatable.rb,
lib/mongoid/matcher/bits.rb,
lib/mongoid/matcher/size.rb,
lib/mongoid/matcher/type.rb,
lib/mongoid/serializable.rb,
lib/mongoid/interceptable.rb,
lib/mongoid/matcher/regex.rb,
lib/mongoid/config/options.rb,
lib/mongoid/extensions/set.rb,
lib/mongoid/matcher/exists.rb,
lib/mongoid/tasks/database.rb,
lib/mongoid/association/one.rb,
lib/mongoid/clients/factory.rb,
lib/mongoid/clients/options.rb,
lib/mongoid/config/defaults.rb,
lib/mongoid/contextual/none.rb,
lib/mongoid/errors/callback.rb,
lib/mongoid/errors/rollback.rb,
lib/mongoid/extensions/date.rb,
lib/mongoid/extensions/hash.rb,
lib/mongoid/extensions/time.rb,
lib/mongoid/fields/standard.rb,
lib/mongoid/matcher/eq_impl.rb,
lib/mongoid/association/many.rb,
lib/mongoid/atomic/modifiers.rb,
lib/mongoid/clients/sessions.rb,
lib/mongoid/contextual/mongo.rb,
lib/mongoid/criteria/options.rb,
lib/mongoid/errors/no_parent.rb,
lib/mongoid/extensions/array.rb,
lib/mongoid/extensions/float.rb,
lib/mongoid/extensions/range.rb,
lib/mongoid/fields/encrypted.rb,
lib/mongoid/fields/localized.rb,
lib/mongoid/search_indexable.rb,
lib/mongoid/tasks/encryption.rb,
lib/mongoid/timestamps/short.rb,
lib/mongoid/association/eager.rb,
lib/mongoid/association/proxy.rb,
lib/mongoid/atomic/paths/root.rb,
lib/mongoid/attributes/nested.rb,
lib/mongoid/config/encryption.rb,
lib/mongoid/contextual/atomic.rb,
lib/mongoid/contextual/memory.rb,
lib/mongoid/criteria/findable.rb,
lib/mongoid/criteria/scopable.rb,
lib/mongoid/extensions/binary.rb,
lib/mongoid/extensions/module.rb,
lib/mongoid/extensions/object.rb,
lib/mongoid/extensions/regexp.rb,
lib/mongoid/extensions/string.rb,
lib/mongoid/extensions/symbol.rb,
lib/mongoid/association/macros.rb,
lib/mongoid/association/nested.rb,
lib/mongoid/attributes/dynamic.rb,
lib/mongoid/config/environment.rb,
lib/mongoid/contextual/command.rb,
lib/mongoid/criteria/queryable.rb,
lib/mongoid/errors/no_metadata.rb,
lib/mongoid/errors/validations.rb,
lib/mongoid/extensions/boolean.rb,
lib/mongoid/extensions/integer.rb,
lib/mongoid/fields/foreign_key.rb,
lib/mongoid/matcher/elem_match.rb,
lib/mongoid/matcher/expression.rb,
lib/mongoid/stringified_symbol.rb,
lib/mongoid/threaded/lifecycle.rb,
lib/mongoid/timestamps/created.rb,
lib/mongoid/timestamps/updated.rb,
lib/mongoid/validatable/format.rb,
lib/mongoid/validatable/length.rb,
lib/mongoid/validatable/macros.rb,
lib/mongoid/association/options.rb,
lib/mongoid/attributes/embedded.rb,
lib/mongoid/attributes/readonly.rb,
lib/mongoid/contextual/geo_near.rb,
lib/mongoid/criteria/includable.rb,
lib/mongoid/criteria/modifiable.rb,
lib/mongoid/criteria/permission.rb,
lib/mongoid/criteria/translator.rb,
lib/mongoid/errors/invalid_find.rb,
lib/mongoid/errors/invalid_path.rb,
lib/mongoid/errors/invalid_time.rb,
lib/mongoid/persistable/logical.rb,
lib/mongoid/persistable/maxable.rb,
lib/mongoid/persistable/minable.rb,
lib/mongoid/persistable/savable.rb,
lib/mongoid/persistence_context.rb,
lib/mongoid/timestamps/timeless.rb,
lib/mongoid/association/bindable.rb,
lib/mongoid/association/builders.rb,
lib/mongoid/attributes/projector.rb,
lib/mongoid/contextual/queryable.rb,
lib/mongoid/criteria/marshalable.rb,
lib/mongoid/errors/invalid_field.rb,
lib/mongoid/errors/invalid_index.rb,
lib/mongoid/errors/invalid_query.rb,
lib/mongoid/errors/invalid_scope.rb,
lib/mongoid/errors/mongoid_error.rb,
lib/mongoid/errors/unknown_model.rb,
lib/mongoid/extensions/date_time.rb,
lib/mongoid/extensions/nil_class.rb,
lib/mongoid/extensions/object_id.rb,
lib/mongoid/extensions/raw_value.rb,
lib/mongoid/matcher/bits_all_set.rb,
lib/mongoid/matcher/bits_any_set.rb,
lib/mongoid/persistable/poppable.rb,
lib/mongoid/persistable/pullable.rb,
lib/mongoid/persistable/pushable.rb,
lib/mongoid/persistable/settable.rb,
lib/mongoid/validatable/presence.rb,
lib/mongoid/association/accessors.rb,
lib/mongoid/association/depending.rb,
lib/mongoid/association/relatable.rb,
lib/mongoid/atomic/paths/embedded.rb,
lib/mongoid/attributes/processing.rb,
lib/mongoid/contextual/aggregable.rb,
lib/mongoid/contextual/map_reduce.rb,
lib/mongoid/errors/no_environment.rb,
lib/mongoid/extensions/decimal128.rb,
lib/mongoid/extensions/true_class.rb,
lib/mongoid/persistable/creatable.rb,
lib/mongoid/persistable/deletable.rb,
lib/mongoid/persistable/renamable.rb,
lib/mongoid/persistable/updatable.rb,
lib/mongoid/validatable/queryable.rb,
lib/mongoid/association/nested/one.rb,
lib/mongoid/atomic_update_preparer.rb,
lib/mongoid/criteria/queryable/key.rb,
lib/mongoid/errors/invalid_options.rb,
lib/mongoid/errors/mixed_relations.rb,
lib/mongoid/errors/no_client_hosts.rb,
lib/mongoid/errors/scope_overwrite.rb,
lib/mongoid/extensions/big_decimal.rb,
lib/mongoid/extensions/false_class.rb,
lib/mongoid/matcher/bits_all_clear.rb,
lib/mongoid/matcher/bits_any_clear.rb,
lib/mongoid/matcher/field_operator.rb,
lib/mongoid/persistable/unsettable.rb,
lib/mongoid/persistable/upsertable.rb,
lib/mongoid/validatable/associated.rb,
lib/mongoid/validatable/uniqueness.rb,
lib/mongoid/association/marshalable.rb,
lib/mongoid/association/nested/many.rb,
lib/mongoid/association/reflections.rb,
lib/mongoid/clients/storage_options.rb,
lib/mongoid/collection_configurable.rb,
lib/mongoid/errors/invalid_includes.rb,
lib/mongoid/errors/invalid_relation.rb,
lib/mongoid/errors/no_client_config.rb,
lib/mongoid/errors/unsaved_document.rb,
lib/mongoid/fields/validators/macro.rb,
lib/mongoid/persistable/destroyable.rb,
lib/mongoid/validatable/localizable.rb,
lib/mongoid/config/validators/client.rb,
lib/mongoid/config/validators/option.rb,
lib/mongoid/criteria/queryable/smash.rb,
lib/mongoid/errors/empty_config_file.rb,
lib/mongoid/errors/inverse_not_found.rb,
lib/mongoid/errors/no_clients_config.rb,
lib/mongoid/errors/no_default_client.rb,
lib/mongoid/errors/readonly_document.rb,
lib/mongoid/errors/transaction_error.rb,
lib/mongoid/errors/unknown_attribute.rb,
lib/mongoid/matcher/field_expression.rb,
lib/mongoid/persistable/multipliable.rb,
lib/mongoid/timestamps/created/short.rb,
lib/mongoid/timestamps/updated/short.rb,
lib/mongoid/association/constrainable.rb,
lib/mongoid/atomic/paths/embedded/one.rb,
lib/mongoid/errors/delete_restriction.rb,
lib/mongoid/errors/document_not_found.rb,
lib/mongoid/errors/invalid_collection.rb,
lib/mongoid/errors/invalid_field_type.rb,
lib/mongoid/errors/no_client_database.rb,
lib/mongoid/errors/readonly_attribute.rb,
lib/mongoid/extensions/time_with_zone.rb,
lib/mongoid/persistable/incrementable.rb,
lib/mongoid/association/eager_loadable.rb,
lib/mongoid/association/embedded/eager.rb,
lib/mongoid/atomic/paths/embedded/many.rb,
lib/mongoid/clients/validators/storage.rb,
lib/mongoid/contextual/aggregable/none.rb,
lib/mongoid/criteria/queryable/options.rb,
lib/mongoid/errors/immutable_attribute.rb,
lib/mongoid/errors/invalid_config_file.rb,
lib/rails/generators/mongoid_generator.rb,
lib/mongoid/association/embedded/cyclic.rb,
lib/mongoid/contextual/aggregable/mongo.rb,
lib/mongoid/criteria/queryable/optional.rb,
lib/mongoid/criteria/queryable/pipeline.rb,
lib/mongoid/criteria/queryable/selector.rb,
lib/mongoid/criteria/queryable/storable.rb,
lib/mongoid/errors/attribute_not_loaded.rb,
lib/mongoid/errors/invalid_field_option.rb,
lib/mongoid/errors/no_map_reduce_output.rb,
lib/mongoid/matcher/eq_impl_with_regexp.rb,
lib/mongoid/matcher/expression_operator.rb,
lib/mongoid/railties/controller_runtime.rb,
lib/mongoid/contextual/aggregable/memory.rb,
lib/mongoid/criteria/queryable/macroable.rb,
lib/mongoid/criteria/queryable/mergeable.rb,
lib/mongoid/errors/invalid_config_option.rb,
lib/mongoid/indexable/validators/options.rb,
lib/mongoid/criteria/queryable/aggregable.rb,
lib/mongoid/criteria/queryable/expandable.rb,
lib/mongoid/criteria/queryable/selectable.rb,
lib/mongoid/errors/ambiguous_relationship.rb,
lib/mongoid/errors/document_not_destroyed.rb,
lib/mongoid/errors/invalid_field_operator.rb,
lib/mongoid/errors/sessions_not_supported.rb,
lib/mongoid/errors/unsupported_javascript.rb,
lib/mongoid/matcher/elem_match_expression.rb,
lib/mongoid/association/embedded/batchable.rb,
lib/mongoid/association/referenced/has_one.rb,
lib/mongoid/errors/drop_collection_failure.rb,
lib/mongoid/errors/invalid_relation_option.rb,
lib/mongoid/errors/invalid_session_nesting.rb,
lib/mongoid/errors/invalid_storage_options.rb,
lib/mongoid/association/embedded/embeds_one.rb,
lib/mongoid/association/referenced/has_many.rb,
lib/mongoid/association/referenced/syncable.rb,
lib/mongoid/association/embedded/embedded_in.rb,
lib/mongoid/association/embedded/embeds_many.rb,
lib/mongoid/association/referenced/auto_save.rb,
lib/mongoid/errors/create_collection_failure.rb,
lib/mongoid/association/referenced/belongs_to.rb,
lib/mongoid/contextual/mongo/documents_loader.rb,
lib/mongoid/criteria/queryable/extensions/set.rb,
lib/mongoid/errors/criteria_argument_required.rb,
lib/mongoid/errors/invalid_dependent_strategy.rb,
lib/mongoid/errors/invalid_persistence_option.rb,
lib/mongoid/errors/mixed_client_configuration.rb,
lib/mongoid/errors/transactions_not_supported.rb,
lib/mongoid/criteria/queryable/extensions/date.rb,
lib/mongoid/criteria/queryable/extensions/hash.rb,
lib/mongoid/criteria/queryable/extensions/time.rb,
lib/mongoid/errors/invalid_elem_match_operator.rb,
lib/mongoid/errors/invalid_expression_operator.rb,
lib/mongoid/errors/invalid_transaction_nesting.rb,
lib/mongoid/railties/bson_object_id_serializer.rb,
lib/mongoid/association/nested/nested_buildable.rb,
lib/mongoid/criteria/queryable/extensions/array.rb,
lib/mongoid/criteria/queryable/extensions/range.rb,
lib/mongoid/errors/invalid_async_query_executor.rb,
lib/mongoid/association/referenced/counter_cache.rb,
lib/mongoid/association/referenced/has_one/eager.rb,
lib/mongoid/association/referenced/has_one/proxy.rb,
lib/mongoid/criteria/queryable/extensions/object.rb,
lib/mongoid/criteria/queryable/extensions/regexp.rb,
lib/mongoid/criteria/queryable/extensions/string.rb,
lib/mongoid/criteria/queryable/extensions/symbol.rb,
lib/mongoid/errors/invalid_dot_dollar_assignment.rb,
lib/mongoid/association/embedded/embeds_one/proxy.rb,
lib/mongoid/association/referenced/has_many/eager.rb,
lib/mongoid/association/referenced/has_many/proxy.rb,
lib/mongoid/criteria/queryable/extensions/boolean.rb,
lib/mongoid/criteria/queryable/extensions/numeric.rb,
lib/mongoid/association/embedded/embedded_in/proxy.rb,
lib/mongoid/association/embedded/embeds_many/proxy.rb,
lib/mongoid/association/referenced/has_one/binding.rb,
lib/mongoid/config/validators/async_query_executor.rb,
lib/mongoid/errors/invalid_estimated_count_scoping.rb,
lib/rails/generators/mongoid/model/model_generator.rb,
lib/mongoid/association/embedded/embeds_one/binding.rb,
lib/mongoid/association/referenced/belongs_to/eager.rb,
lib/mongoid/association/referenced/belongs_to/proxy.rb,
lib/mongoid/association/referenced/has_many/binding.rb,
lib/mongoid/criteria/queryable/extensions/date_time.rb,
lib/mongoid/criteria/queryable/extensions/nil_class.rb,
lib/mongoid/errors/invalid_discriminator_key_target.rb,
lib/mongoid/errors/invalid_estimated_count_criteria.rb,
lib/mongoid/errors/invalid_set_polymorphic_relation.rb,
lib/mongoid/association/embedded/embedded_in/binding.rb,
lib/mongoid/association/embedded/embeds_many/binding.rb,
lib/mongoid/association/referenced/has_one/buildable.rb,
lib/mongoid/errors/in_memory_collation_not_supported.rb,
lib/mongoid/errors/too_many_nested_attribute_records.rb,
lib/rails/generators/mongoid/config/config_generator.rb,
lib/mongoid/association/embedded/embeds_one/buildable.rb,
lib/mongoid/association/referenced/belongs_to/binding.rb,
lib/mongoid/association/referenced/has_many/buildable.rb,
lib/mongoid/criteria/queryable/extensions/big_decimal.rb,
lib/mongoid/association/embedded/embedded_in/buildable.rb,
lib/mongoid/association/embedded/embeds_many/buildable.rb,
lib/mongoid/association/referenced/has_many/enumerable.rb,
lib/mongoid/errors/invalid_global_executor_concurrency.rb,
lib/mongoid/association/referenced/belongs_to/buildable.rb,
lib/mongoid/errors/nested_attributes_metadata_not_found.rb,
lib/mongoid/criteria/queryable/extensions/time_with_zone.rb,
lib/mongoid/errors/invalid_auto_encryption_configuration.rb,
lib/mongoid/association/referenced/has_and_belongs_to_many.rb,
lib/mongoid/association/referenced/has_and_belongs_to_many/eager.rb,
lib/mongoid/association/referenced/has_and_belongs_to_many/proxy.rb,
lib/mongoid/association/referenced/has_and_belongs_to_many/binding.rb,
lib/mongoid/association/referenced/has_and_belongs_to_many/buildable.rb
Overview
rubocop:todo all
Defined Under Namespace
Modules: Association, Atomic, Attributes, Cacheable, Changeable, Clients, CollectionConfigurable, Composable, Config, Contextual, Copyable, Deprecable, Document, Encryptable, Equality, Errors, Evolvable, Extensions, Factory, Fields, Findable, Generators, GlobalDiscriminatorKeyAssignment, Indexable, Interceptable, Loadable, Loggable, Matchable, Matcher, Persistable, Positional, Railties, Reloadable, Scopable, SearchIndexable, Selectable, Serializable, Shardable, Stateful, Tasks, Threaded, Timestamps, Touchable, Traversable, Utils, Validatable, Warnings Classes: AtomicUpdatePreparer, Boolean, Criteria, Deprecation, PersistenceContext, RawValue, StringifiedSymbol
Constant Summary collapse
- PLATFORM_DETAILS =
A string added to the platform details of Ruby driver client handshake documents.
"mongoid-#{VERSION}".freeze
- MONGODB_VERSION =
The minimum MongoDB version supported.
"2.6.0"
- VERSION =
"9.0.0.alpha"
Constants included from Loadable
Constants included from Clients::Sessions::ClassMethods
Clients::Sessions::ClassMethods::CALLBACK_ACTIONS
Instance Method Summary collapse
-
#client(name) ⇒ Mongo::Client
Convenience method for getting a named client.
-
#configure(&block) ⇒ Config
Sets the Mongoid configuration options.
-
#default_client ⇒ Mongo::Client
Convenience method for getting the default client.
-
#disconnect_clients ⇒ true
Disconnect all active clients.
-
#persistence_context ⇒ Object
private
Define persistence context that is used when a transaction method is called on Mongoid module.
-
#RawValue(*args) ⇒ Mongoid::RawValue
Instantiates a new Mongoid::RawValue object.
-
#storage_options ⇒ Object
private
Define client that is used when a transaction method is called on Mongoid module.
Methods included from Loggable
Methods included from Loadable
load_model, load_models, model_paths, model_paths=
Methods included from Clients::Sessions::ClassMethods
after_commit, after_create_commit, after_destroy_commit, after_rollback, after_save_commit, after_update_commit, transaction, with_session
Methods included from GlobalDiscriminatorKeyAssignment
Methods included from Deprecable
Instance Method Details
#client(name) ⇒ Mongo::Client
Convenience method for getting a named client.
109 110 111 |
# File 'lib/mongoid.rb', line 109 def client(name) Clients.with_name(name) end |
#configure(&block) ⇒ Config
Sets the Mongoid configuration options. Best used by passing a block.
77 78 79 80 81 |
# File 'lib/mongoid.rb', line 77 def configure(&block) return Config unless block_given? block.arity == 0 ? Config.instance_exec(&block) : yield(Config) end |
#default_client ⇒ Mongo::Client
Convenience method for getting the default client.
89 90 91 |
# File 'lib/mongoid.rb', line 89 def default_client Clients.default end |
#disconnect_clients ⇒ true
Disconnect all active clients.
99 100 101 |
# File 'lib/mongoid.rb', line 99 def disconnect_clients Clients.disconnect end |
#persistence_context ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Define persistence context that is used when a transaction method is called on Mongoid module.
124 125 126 |
# File 'lib/mongoid.rb', line 124 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.
13 14 15 |
# File 'lib/mongoid/extensions/raw_value.rb', line 13 def RawValue(*args) RawValue.new(*args) end |
#storage_options ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Define client that is used when a transaction method is called on Mongoid module. This MUST be the default client.
132 133 134 |
# File 'lib/mongoid.rb', line 132 def { client: :default } end |