mongodb/mongoid

View on GitHub
lib/config/locales/en.yml

Summary

Maintainability
Test Coverage
en:
  errors:
    messages:
      taken: "has already been taken"

  mongoid:
    errors:
      messages:
        blank_in_locale:
          "can't be blank in %{location}"
        message_title: "message"
        summary_title: "summary"
        resolution_title: "resolution"

        ambiguous_relationship:
          message: "Ambiguous associations %{candidates} defined on %{klass}."
          summary:
            "When Mongoid attempts to set an inverse document of an association
            in memory, it needs to know which association it belongs to. When
            setting %{name}, Mongoid looked on the class %{inverse}
            for a matching association, but multiples were found that could
            potentially match: %{candidates}."
          resolution: "On the %{name} association on %{inverse} you must add an
            :inverse_of option to specify the exact association on %{klass}
            that is the opposite of %{name}."
        attribute_not_loaded:
          message: "Attempted to access attribute '%{name}' on %{klass} which
            was not loaded."
          summary:
            "You loaded an instance of %{klass} using a query projection method
            such as `.only` or `.without`, then attempted to read or write an
            attribute '%{name}' which was not included in the projection.
            Mongoid intentionally prevents this to avoid overwriting data."
          resolution: "Ensure your query projection methods such as `.only` and
            `.without` include field '%{name}' when loading instances of %{klass},
            or remove such projections methods entirely."
        callbacks:
          message: "Calling %{method} on %{klass} resulted in a false return
            from a callback."
          summary: "If a before callback returns false when using Document.create!,
            Document#save!, or Document#update_attributes! this error will get raised
            since the document did not actually get saved."
          resolution: "Double check all before callbacks to make sure they are
            not unintentionally returning false."
        create_collection_failure:
          message: "Cannot create collection %{collection_name}
            with options %{collection_options}. The following error was raised:
            %{error}."
          summary: "The server rejected createCollection command with given collection
            options. This may happen when some of the options are invalid, or not
            supported by your version of the server."
          resolution: "Double check that collection options for the collection
            %{collection_name} are valid. Consult with Ruby driver documentation
            and MongoDB documentation if the desired options are supported by
            your version of the server."
        criteria_argument_required:
          message: "Calling Criteria methods with nil arguments is not allowed."
          summary: "Arguments to Criteria methods cannot be nil, and most
            Criteria methods require at least one argument. Only logical
            operations (and, or, nor and not), `all' and `where' can be called
            without arguments.
            The method that was called with nil argument was: %{query_method}."
          resolution: "Invoke Criteria methods with non-nil arguments or omit
            the respective invocations."
        calling_document_find_with_nil_is_invalid:
          message: "Calling Document.find with nil is invalid."
          summary: "Document.find expects the parameters to be 1 or more ids, and
            will return a single document if 1 id is provided, otherwise an array
            of documents if multiple ids are provided."
          resolution: "Most likely this is caused by passing parameters directly
            through to the find, and the parameter either is not present or the
            key from which it is accessed is incorrect."
        destroy_restrict_with_error_dependencies_exist:
          "is not empty and prevents the document from being destroyed"
        document_not_destroyed:
          message: "%{klass} with id %{id} was not destroyed."
          summary: "When calling %{klass}#destroy! and a callback halts the destroy
            callback chain by returning a false value, the deletion will not
            actually occur."
          resolution: "Check the before/after destroy callbacks to ensure that the
            return values are truthy for the chain to continue."
        document_not_found:
          message: "Document(s) not found for class %{klass} with id(s) %{missing}."
          summary: "When calling %{klass}.find with an id or array of ids, each
            parameter must match a document in the database or this error will be
            raised. The search was for the id(s): %{searched} (%{total} total)
            and the following ids were not found: %{missing}."
          resolution: "Search for an id that is in the database or set
            the Mongoid.raise_not_found_error configuration option to false,
            which will cause nil to be returned instead of raising this error when
            searching for a single id, or only the matched documents when searching
            for multiples."
        document_with_attributes_not_found:
          message: "Document not found for class %{klass} with attributes %{attributes}."
          summary: "When calling %{klass}.find_by with a hash of attributes, all
            attributes provided must match a document in the database or this error
            will be raised."
          resolution: "Search for attributes that are in the database or set
            the Mongoid.raise_not_found_error configuration option to false,
            which will cause nil to be returned instead of raising this error."
        document_with_shard_key_not_found:
          message: "Document not found for class %{klass} with id %{missing} and
            shard key %{shard_key}."
          summary: "When calling %{klass}.find with an id and a shard key, each
            parameter must match a document in the database or this error will
            be raised. The search was for the id: %{missing} with
            shard_key: %{shard_key} and it was not found."
          resolution: "Search for an id/shard key that is in the database or set
            the Mongoid.raise_not_found_error configuration option to false,
            which will cause nil to be returned instead of raising this error."
        drop_collection_failure:
          message: "Cannot drop collection %{collection_name}."
          summary: "Mongoid tried to drop collection %{collection_name}, but the
            collection still exists in the database."
          resolution: "Try to drop the collection manually using Ruby driver or
            mongo shell."
        empty_config_file:
          message: "Empty configuration file: %{path}."
          summary: "Your mongoid.yml configuration file appears to be empty."
          resolution: "Ensure your configuration file contains the correct contents.
            Refer to: https://www.mongodb.com/docs/mongoid/current/reference/configuration/"
        immutable_attribute:
          message: "Attempted to change the immutable attribute '%{name}' with
            the value: %{value}."
          summary: "Immutable attributes can only have values set when the
            document is a new record."
          resolution: "Do not attempt to update the value of '%{name}' after
            the document is persisted."
        invalid_collection:
          message: "Access to the collection for %{klass} is not allowed."
          summary: "%{klass}.collection was called, and %{klass} is an embedded
            document - it resides within the collection of the root document of
            the hierarchy."
          resolution: "For access to the collection that the embedded document is
            in, use %{klass}#_root.collection, or do not attempt to persist an
            embedded document without a parent set."
        in_memory_collation_not_supported:
          message: "A collation option cannot be applied when querying documents in-memory."
          summary: "The query being run against documents in memory has a collation option set.
            A collation option is only supported if the query is executed on a MongoDB server
            with version >= 3.4."
          resolution: "Remove the collation option from the query."
        invalid_async_query_executor:
          message: "Invalid async_query_executor option: %{executor}."
          summary: "A invalid async query executor was specified.
            The valid options are: %{options}."
          resolution: "Pick an allowed option or fix the typo. If you were
            expecting the option to be there, please consult the following page
            with respect to Mongoid's configuration:\n\n
            \_\_https://www.mongodb.com/docs/mongoid/current/reference/configuration/#mongoid-configuration-options"
        invalid_auto_encryption_configuration:
          message: "Invalid automatic encryption configuration for client %{client}."
          summary: "Automatic encryption options for client %{client} are
            incomplete or invalid."
          resolution: "Please consult the following page with respect to
            automatic encryption configuration:\n\n
            \_\_https://www.mongodb.com/docs/ruby-driver/current/reference/client-side-encryption/#auto-encryption-options"
        invalid_auto_encryption_configuration_for_kms_provider:
          message: "Automatic encryption configuration for client %{client} does
            not include options for kms_provider %{kms_provider}"
          summary: "Automatic encryption configuration for client %{client} does
            not include options for kms_provider %{kms_provider} in :kms_providers
            hash."
          resolution: "Check kms_provider name and :kms_providers options.
            Please consult the following page with respect to
            automatic encryption configuration:\n\n
            \_\_https://www.mongodb.com/docs/ruby-driver/current/reference/client-side-encryption/#auto-encryption-options"
        invalid_config_file:
          message: "Invalid configuration file: %{path}."
          summary: "Your mongoid.yml configuration file does not contain the
            correct file structure."
          resolution: "Ensure your configuration file contains the correct contents.
            Refer to: https://www.mongodb.com/docs/mongoid/current/reference/configuration/"
        invalid_config_option:
          message: "Invalid configuration option: %{name}."
          summary: "A invalid configuration option was provided in your
            mongoid.yml, or a typo is potentially present. The valid configuration
            options are: %{options}."
          resolution: "Remove the invalid option or fix the typo. If you were
            expecting the option to be there, please consult the following page
            with respect to Mongoid's configuration:\n\n
            \_\_http://mongoid.org/en/mongoid/docs/installation.html"
        invalid_dependent_strategy:
          message: "Invalid dependent strategy: %{invalid_strategy}."
          summary: "An invalid dependent strategy was defined for the association:
            %{association}. The valid strategies are: %{valid_strategies}."
          resolution: "Change the dependent strategy to one of the valid types."
        invalid_discriminator_key_target:
          message: "Setting the discriminator key on a child class is not allowed."
          summary: "The discriminator key on the class %{class_name} was attempted
            to be changed. Changing the discriminator key on a child class is not
            allowed."
          resolution: "Try setting the discriminator key on %{superclass} or one of %{class_name}'s
            ancestors."
        invalid_dot_dollar_assignment:
          message: "Cannot set the %{attr} attribute on the %{klass} class."
          summary: "Calling the setters for fields that start with a dollar
            sign ($) or contain a dot/period (.) is prohibited. See the
            Mongoid documentation on Field Names with Dots/Periods (.) and
            Dollar Signs ($) for more information."
          resolution: "In order to set fields that start with a dollar
            sign ($) or contain a dot/period (.), the aggregation pipeline can
            be used. MongoDB provides specific operators for working with these
            fields. Refer to the MongoDB documentation here:
            https://www.mongodb.com/docs/manual/core/dot-dollar-considerations/"
        invalid_elem_match_operator:
          message: "Invalid $elemMatch operator '%{operator}'."
          summary: "You misspelled an operator or are using an operator that
            Mongoid does not support."
          resolution: "Valid field operators are: %{valid_operators}.
            Ensure you are using one of these operators."
        invalid_estimated_count_criteria:
          message: "Invalid criteria for estimated_count."
          summary: "Estimated count is strictly a collection-level operation and cannot be called
            on a filtered criteria."
          resolution: "Try calling estimated_count directly on the class: %{class_name}.estimated_count."
        invalid_estimated_count_scoping:
          message: "Invalid criteria for estimated_count."
          summary: "Estimated count is strictly a collection-level operation and cannot be called
            on a model that uses a default scope."
          resolution: "Try calling estimated_count using unscoped: %{class_name}.unscoped.estimated_count.
            Alternatively, the #count method can be used, which is usable with scoping."
        invalid_expression_operator:
          message: "Invalid expression operator '%{operator}'."
          summary: "You misspelled an operator, are using an operator that
            Mongoid does not support, or are trying to use a field-level
            operator on expression level."
          resolution: "Valid expression operators are: %{valid_operators}.
            Ensure you are using one of these operators."
        invalid_field:
          message: "Defining a field named '%{field}' is not allowed."
          summary: "Defining this field would override the method '%{name}',
            which would cause issues with expectations around the original
            method and cause extremely hard to debug issues. The original
            method was defined in:\n
            \_\_Object: %{origin}\n
            \_\_File: %{file}\n
            \_\_Line: %{line}"
          resolution: "Use Mongoid.destructive_fields to see what names are not
            allowed, and don't use these names. These include names that also
            conflict with core Ruby methods on Object, Module, Enumerable, or
            included gems that inject methods into these or Mongoid internals."
        invalid_field_operator:
          message: "Invalid field operator '%{operator}'."
          summary: "You misspelled an operator, are using an operator that
            Mongoid does not support, or are trying to use an expression-level
            operator on field level."
          resolution: "Valid field operators are: %{valid_operators}.
            Ensure you are using one of these operators."
        invalid_field_option:
          message: "Invalid option :%{option} provided for field :%{name}."
          summary: "Mongoid requires that you only provide valid options on each
            field definition in order to prevent unexpected behavior later on."
          resolution: "When defining the field :%{name} on '%{klass}', please provide
            valid options for the field. These are currently: %{valid}. If you
            meant to define a custom field option, please do so first as follows:\n\n
            \_\_Mongoid::Fields.option :%{option} do |model, field, value|\n
            \_\_\_\_# Your logic here...\n
            \_\_end\n
            \_\_class %{klass}\n
            \_\_\_\_include Mongoid::Document\n
            \_\_\_\_field :%{name}, %{option}: true\n
            \_\_end\n\n
            Refer to:
            https://www.mongodb.com/docs/mongoid/current/reference/fields/#custom-field-options"
        invalid_field_type:
          message: "Invalid field type %{type_inspection} for field '%{field}' on model '%{klass}'."
          summary: "Model '%{klass}' defines a field '%{field}' with an unknown type value
            %{type_inspection}."
          resolution: "Please provide a valid type value for the field.
            Refer to:
            https://www.mongodb.com/docs/mongoid/current/reference/fields/#using-symbols-or-strings-instead-of-classes"
        invalid_global_executor_concurrency:
          message: "Invalid global_executor_concurrency option."
          summary: "You set global_executor_concurrency while async_query_executor
            option is not set to :global_thread_pool. The global_executor_concurrency is
            allowed only for the global thread pool executor."
          resolution: "Set global_executor_concurrency option to :global_thread_pool
            or remove global_executor_concurrency option."
        invalid_includes:
          message: "Invalid includes directive: %{klass}.includes(%{args})"
          summary: "Eager loading in Mongoid only supports providing arguments
            to %{klass}.includes that are the names of associations on the %{klass}."
          resolution: "Ensure that each parameter passed to %{klass}.includes is
            a valid name of an association on the %{klass} model. These are: %{relations}."
        invalid_index:
          message: "Invalid index specification on %{klass}: %{spec}, %{options}"
          summary: "Indexes in Mongoid are defined as a hash of field name and
            direction/2d pairs, with a hash for any additional options."
          resolution: "Ensure that the index conforms to the correct syntax and
            has the correct options.\n\n
            Valid options are:\n
            \_\_background: true|false\n
            \_\_database: 'database_name'\n
            \_\_name: 'index_name'\n
            \_\_sparse: true|false\n
            \_\_unique: true|false\n
            \_\_min: 1\n
            \_\_max: 1\n
            \_\_bits: 26\n
            \_\_key: 26\n
            \_\_bucket_size : 1\n
            \_\_sphere_version : 1\n
            \_\_text_version : 1\n
            \_\_version : 1\n
            \_\_weights: { content: 1, title: 2 }\n
            \_\_expire_after_seconds: number_of_seconds\n
            \_\_partial_filter_expression\n
            \_\_storage_engine\n
            \_\_language_override\n
            \_\_default_language\n
            \_\_collation\n
            \_\_wildcard_projection: { 'path.to.field.a': 1, 'path.to.field.b': 0 }\n
            Valid types are: 1, -1, '2d', '2dsphere', 'geoHaystack (deprecated)', 'text', 'hashed'\n\n
            Example:\n
            \_\_class Band\n
            \_\_\_\_include Mongoid::Document\n
            \_\_\_\_index({ name: 1, label: -1 }, { sparse: true })\n
            \_\_\_\_index({ location: '2d' }, { background: true })\n
            \_\_end\n\n"
        invalid_options:
          message: "Invalid option :%{invalid} provided to association :%{name}."
          summary: "Mongoid checks the options that are passed to the association
            macros to ensure that no ill side effects occur by letting something
            slip by."
          resolution: "Valid options are: %{valid}, make sure these are the ones
            you are using."
        invalid_path:
          message: "Having a root path assigned for %{klass} is invalid."
          summary: "Mongoid has two different path objects for determining
            the location of a document in the database, Root and Embedded.
            This error is raised when an embedded document somehow gets a
            root path assigned."
          resolution: "Most likely your embedded model, %{klass} is also
            referenced via a has_many from a root document in another
            collection. Double check the association definitions and fix any
            instances where embedded documents are improperly referenced
            from other collections."
        invalid_persistence_option:
          message: "Invalid persistence option :%{invalid}."
          summary: "The options used to change the persistence context must be one
             of the valid options for a mongo client, or a collection name."
          resolution: "Valid options are: %{valid}, make sure these are the ones
             you are using."
        invalid_relation:
          message: "Defining an association named '%{name}' is not allowed."
          summary: "Defining this association would override the method '%{name}',
            which would cause issues with expectations around the original
            method and cause extremely hard to debug issues. The original
            method was defined in:\n
            \_\_Object: %{origin}\n
            \_\_File: %{file}\n
            \_\_Line: %{line}"
          resolution: "Use Mongoid.destructive_fields to see what names are not
            allowed, and don't use these names. These include names that also
            conflict with core Ruby methods on Object, Module, Enumerable, or
            included gems that inject methods into these or Mongoid internals."
        invalid_relation_option:
          message: "Invalid association option :%{option} for association '%{name}' on class
            %{klass}."
          summary: "An invalid option was provided for an association."
          resolution: "Valid options are: %{valid_options}, make sure you use only those."
        invalid_scope:
          message: "Defining a scope of value %{value} on %{klass} is not
            allowed."
          summary: "Scopes in Mongoid must be procs that wrap criteria objects."
          resolution: "Change the scope to be a proc wrapped criteria.\n\n
            Example:\n
            \_\_class Band\n
            \_\_\_\_include Mongoid::Document\n
            \_\_\_\_scope :inactive, ->{ where(active: false) }\n
            \_\_end\n\n"
        invalid_session_use:
          message: "A session was attempted to be used with a model whose client cannot use
            that session."
          summary: "Sessions are started via driver clients (Model#mongo_client) and, in most cases, driver
            clients are shared across models. When different models have their own clients, a session cannot
            be obtained via one model and used for operations on another model."
          resolution: "Only execute operations on the model class or instances of the model through which
            the session was created. Otherwise, ensure that all models on which operations are executed
            in the session block share the same driver client. For example, a model may have a different
            client specified in its 'store_in' options.\n\n"
        invalid_session_nesting:
          message: "A session was started while another session was being used on this client."
          summary: "Sessions cannot be nested. Only one session can be used in a thread per client."
          resolution: "Only use one session per client at a time; sessions cannot be nested."
        invalid_storage_options:
          message: "Invalid options passed to %{klass}.store_in: %{options}."
          summary: "The :store_in macro takes only a hash of parameters with
            the keys :database, :collection, :collection_options, or :client."
          resolution: "Change the options passed to store_in to match the
            documented API, and ensure all keys in the options hash are
            symbols.\n\n
            Example:\n
            \_\_class Band\n
            \_\_\_\_include Mongoid::Document\n
            \_\_\_\_store_in collection: 'artists', database: 'music'\n
            \_\_end\n\n"
        invalid_time:
          message: "'%{value}' is not a valid Time."
          summary: "Mongoid tries to serialize the values for Date, DateTime, and
            Time into proper UTC times to store in the database. The provided
            value could not be parsed."
          resolution: "Make sure to pass parsable values to the field setter
            for Date, DateTime, and Time objects. When this is a String it needs
            to be valid for Time.parse. Other objects must be valid to pass to
            Time.local."
        invalid_transaction_nesting:
          message: "A transaction was started while another transaction was being used on this client."
          summary: "Transactions cannot be nested. Only one transaction can be used in a thread per client."
          resolution: "Only use one transaction per client at a time; transactions cannot be nested."
        inverse_not_found:
          message: "When adding a(n) %{klass} to %{base}#%{name}, Mongoid could
            not determine the inverse foreign key to set. The attempted key was
            '%{inverse}'."
          summary: "When adding a document to an association, Mongoid attempts
            to link the newly added document to the base of the association in
            memory, as well as set the foreign key to link them on the
            database side. In this case Mongoid could not determine what the
            inverse foreign key was."
          resolution: "If an inverse is not required, like a belongs_to or
            has_and_belongs_to_many, ensure that :inverse_of => nil is set
            on the association. If the inverse is needed, most likely the
            inverse cannot be figured out from the names of the associations and
            you will need to explicitly tell Mongoid on the association what
            the inverse is.\n\n
            Example:\n
            \_\_class Car\n
            \_\_\_\_include Mongoid::Document\n
            \_\_\_\_has_one :engine, class_name: \"Motor\", inverse_of: :machine\n
            \_\_end\n\n
            \_\_class Motor\n
            \_\_\_\_include Mongoid::Document\n
            \_\_\_\_belongs_to :machine, class_name: \"Car\", inverse_of: :engine\n
            \_\_end"
        invalid_set_polymorphic_relation:
          message: "The %{name} attribute can't be set to an instance of
            %{other_klass} as %{other_klass} has multiple associations referencing
            %{klass} as %{name}."
          summary: "If the parent class of a polymorphic association has multiple
            definitions for the same association, the values must be set from the
            parent side and not the child side since Mongoid cannot determine
            from the child side which association to go in."
          resolution: "Set the values from the parent, or redefine the association
            with only a single definition in the parent."
        mixed_relations:
          message: "Referencing a(n) %{embedded} document from the %{root}
            document via a non-embedded association is not allowed since the
            %{embedded} is embedded."
          summary: "In order to properly access a(n) %{embedded} from %{root}
            the reference would need to go through the root document of
            %{embedded}. In a simple case this would require Mongoid to store
            an extra foreign key for the root, in more complex cases where
            %{embedded} is multiple levels deep a key would need to be stored
            for each parent up the hierarchy."
          resolution: "Consider not embedding %{embedded}, or do the key
            storage and access in a custom manner in the application code."
        mixed_client_configuration:
          message: "Both uri and standard configuration options defined for
            client: '%{name}'."
          summary: "Instead of simply giving uri or standard options a
            preference order, Mongoid assumes that you have made a mistake in
            your configuration and requires that you provide one or the other,
            but not both. The options that were provided were: %{config}."
          resolution: "Provide either only a uri as configuration or only
            standard options."
        nested_attributes_metadata_not_found:
          message: "Could not find metadata for association '%{name}' on model:
            %{klass}."
          summary: "When defining nested attributes for an association, Mongoid
            needs to access the metadata for the association '%{name}' in order
            if add autosave functionality to it, if applicable. Either no
            association named '%{name}' could be found, or the association had not
            been defined yet."
          resolution: "Make sure that there is an association defined named
            '%{name}' on %{klass} or that the association definition comes before
            the accepts_nested_attributes_for macro in the model - order
            matters so that Mongoid has access to the metadata.\n\n
            Example:\n
            \_\_class Band\n
            \_\_\_\_include Mongoid::Document\n
            \_\_\_\_has_many :albums\n
            \_\_\_\_accepts_nested_attributes_for :albums\n
            \_\_end\n\n"
        no_default_client:
          message: "No default client configuration is defined."
          summary: "The configuration provided settings for: %{keys}, but
            Mongoid requires a :default to be defined at minimum."
          resolution: "If configuring via a mongoid.yml, ensure that within
            your :clients section a :default client is defined.\n\n
            Example:\n
            \_\_development:\n
            \_\_\_\_clients:\n
            \_\_\_\_\_\_default:\n
            \_\_\_\_\_\_\_\_hosts:\n
            \_\_\_\_\_\_\_\_\_\_- localhost:27017\n\n"
        no_documents_found:
          message: "Could not find a document of class %{klass}."
          summary: "Mongoid attempted to find a document of the class %{klass}
            but none exist."
          resolution: "Create a document of class %{klass} or use a finder
            method that does not raise an exception when no documents are
            found."
        no_environment:
          message: "Could not load the configuration since no environment
            was defined."
          summary: "Mongoid could not determine the environment to use because
            it was not specified in any of the following locations:
            Rails.env, Sinatra::Base.environment,
            ENV[\"RACK_ENV\"], ENV[\"MONGOID_ENV\"]. Without knowing the
            environment, Mongoid cannot load its configuration."
          resolution: "Please ensure an environment is set in one of the
            listed locations. The environment must be explicitly set."
        no_map_reduce_output:
          message: "No output location was specified for the map/reduce
            operation."
          summary: "When executing a map/reduce, you must provide the output
            location of the results. The attempted command was: %{command}."
          resolution: "Provide the location that the output of the operation
            is to go by chaining an #out call to the map/reduce.\n\n
            Example:\n
            \_\_Band.map_reduce(map, reduce).out(inline: 1)\n\n
            Valid options for the out function are:\n
            \_\_inline:  1\n
            \_\_merge:   'collection-name'\n
            \_\_replace: 'collection-name'\n
            \_\_reduce:  'collection-name'\n\n"
        no_metadata:
          message: "Metadata not found for document of type %{klass}."
          summary: "Mongoid sets the metadata of an association on the document
            when it is either loaded from within the association, or added to
            one. The presence of the metadata is required in order to
            provide various functionality around associations. Most likely you
            are getting this error because the document is embedded and was
            attempted to be persisted without being associated with a parent,
            or the association was not properly defined."
          resolution: "Ensure that your associations on the %{klass} model
            are all properly defined, and that the inverse associations
            are also properly defined. Embedded associations must have both the
            parent (embeds_one/embeds_many) and the inverse (embedded_in)
            present in order to work properly."
        no_parent:
          message: "Cannot persist embedded document %{klass} without a
            parent document."
          summary: "If the document is embedded, in order to be persisted it
            must always have a reference to its parent document. This is
            most likely caused by either calling %{klass}.create or
            %{klass}.create! without setting the parent document as an
            attribute."
          resolution: "Ensure that you've set the parent association if
            instantiating the embedded document directly, or always create new
            embedded documents via the parent association."
        no_client_config:
          message: "No configuration could be found for a client named
            '%{name}'."
          summary: "When attempting to create the new client, Mongoid could
            not find a client configuration for the name: '%{name}'. This is
            necessary in order to know the host, port, and options needed
            to connect."
          resolution: "Double check your mongoid.yml to make sure under the
            clients key that a configuration exists for '%{name}'. If you
            have set the configuration programmatically, ensure that '%{name}'
            exists in the configuration hash."
        no_clients_config:
          message: "No clients configuration provided."
          summary: "Mongoid's configuration requires that you provide details
            about each client that can be connected to, and requires in
            the clients config at least 1 default client to exist."
          resolution: "Double check your mongoid.yml to make sure that you
            have a top-level clients key with at least 1 default client
            configuration for it. You can regenerate a new mongoid.yml for
            assistance via `rails g mongoid:config`.\n\n
            Example:\n
            \_\_development:\n
            \_\_\_\_clients:\n
            \_\_\_\_\_\_default:\n
            \_\_\_\_\_\_\_\_database: mongoid_dev\n
            \_\_\_\_\_\_\_\_hosts:\n
            \_\_\_\_\_\_\_\_\_\_- localhost:27017\n\n"
        no_client_database:
          message: "No database provided for client configuration: :%{name}."
          summary: "Each client configuration must provide a database so Mongoid
            knows where the default database to persist to. What was provided
            was: %{config}."
          resolution: "If configuring via a mongoid.yml, ensure that within
            your :%{name} section a :database value for the client's default
            database is defined.\n\n
            Example:\n
            \_\_development:\n
            \_\_\_\_clients:\n
            \_\_\_\_\_\_%{name}:\n
            \_\_\_\_\_\_\_\_database: my_app_db\n
            \_\_\_\_\_\_\_\_hosts:\n
            \_\_\_\_\_\_\_\_\_\_- localhost:27017\n\n"
        no_client_hosts:
          message: "No hosts provided for client configuration: :%{name}."
          summary: "Each client configuration must provide hosts so Mongoid
            knows where the database server is located. What was provided
            was: %{config}."
          resolution: "If configuring via a mongoid.yml, ensure that within
            your :%{name} section a :hosts value for the client hosts is
            defined.\n\n
            Example:\n
            \_\_development:\n
            \_\_\_\_clients:\n
            \_\_\_\_\_\_%{name}:\n
            \_\_\_\_\_\_\_\_database: my_app_db\n
            \_\_\_\_\_\_\_\_hosts:\n
            \_\_\_\_\_\_\_\_\_\_- localhost:27017\n\n"
        readonly_attribute:
          message: "Attempted to set the readonly attribute '%{name}' with
            the value: %{value}."
          summary: "Attributes flagged as readonly via Model.attr_readonly
            can only have values set when the document is a new record."
          resolution: "Don't define '%{name}' as readonly, or do not attempt
            to update its value after the document is persisted."
        readonly_document:
          message: "Attempted to persist a readonly document of class '%{klass}'."
          summary: "Documents that are marked readonly cannot be persisted."
          resolution: "Don't attempt to persist documents that are flagged as
            readonly."
        scope_overwrite:
          message: "Cannot create scope :%{scope_name}, because of existing
            method %{model_name}.%{scope_name}."
          summary: "When defining a scope that conflicts with a method that
            already exists on the model, this error will get raised if
            Mongoid.scope_overwrite_exception is set to true."
          resolution: "Change the name of the scope so it does not conflict
            with the already defined method %{model_name}, or set the
            configuration option Mongoid.scope_overwrite_exception to false,
            which is its default. In this case a warning will be logged."
        sessions_not_supported:
          message: "Sessions are not supported by the connected server(s)."
          summary: "A session was attempted to be used with a MongoDB server version
            that doesn't support sessions. Sessions are supported in MongoDB
            server versions 3.6 and higher."
          resolution: "Verify that all servers in your deployment are at least
            version 3.6 or don't attempt to use sessions with older server versions."
        too_many_nested_attribute_records:
          message: "Accepting nested attributes for %{association} is limited
            to %{limit} documents."
          summary: "More documents were sent to be processed than the allowed
            limit."
          resolution: "The limit is set as an option to the macro, for example:
            accepts_nested_attributes_for :%{association}, limit: %{limit}.
            Consider raising this limit or making sure no more are sent than
            the set value."
        transactions_not_supported:
          message: "Transactions are not supported by the connected server(s)."
          summary: "A session was attempted to be used with a MongoDB server version
            that doesn't support transactions. Transactions are supported in MongoDB
            server versions 3.6 and higher."
          resolution: "Verify that all servers in your deployment are at least
            version 3.6 or don't attempt to use transactions with older server versions."
        transaction_error:
          message: "Transaction failed with the following error: %{error}."
          summary: "The transaction failed because MongoDB server or MongoDB driver
            raised an unexpected error."
          resolution: "Consult with Ruby driver documentation
            and MongoDB documentation."
        unknown_attribute:
          message: "Attempted to set a value for '%{name}' which is not
            allowed on the model %{klass}."
          summary: "%{klass}#%{name}= was called but there is no '%{name}'
            field defined in the model, and Mongoid::Attributes::Dynamic is
            not included. This error is also raised instead of NoMethodError
            if the unknown attribute is passed to any method that accepts an
            attributes hash, such as #attributes=."
          resolution: "Define the field '%{name}' in %{klass}, or include
            Mongoid::Attributes::Dynamic in %{klass} if you intend to
            store values in fields that are not explicitly defined."
        unknown_model:
          message: "Attempted to instantiate an object of the unknown model '%{klass}'."
          summary: "A document with the value '%{value}' at the key '_type' was used to
            instantiate a model object but Mongoid cannot find this Class."
          resolution: "The _type field is a reserved one used by Mongoid to determine the
            class for instantiating an object. Please don't save data in this field or ensure
            that any values in this field correspond to valid models."
        unsaved_document:
          message: "Attempted to save %{document} before the parent %{base}."
          summary: "You cannot call create or create! through the
            association (%{document}) whose parent (%{base}) is
            not already saved. This would cause the database to be out of sync
            since the child could potentially reference a nonexistent parent."
          resolution: "Make sure to only use create or create! when the parent
            document %{base} is persisted."
        unsupported_javascript:
          message: "Executing Javascript $where selector on an embedded criteria
            is not supported."
          summary: "Mongoid only supports providing a hash of arguments to
            #where criterion on embedded documents. Since %{klass} is embedded,
            the expression %{javascript} is not allowed."
          resolution: "Please provide a standard hash to #where when the criteria
            is for an embedded association."
        validations:
          message: "Validation of %{document} failed."
          summary: "The following errors were found: %{errors}"
          resolution: "Try persisting the document with valid data or remove
            the validations."
        delete_restriction:
          message: "Cannot destroy %{document} because of dependent '%{relation}'."
          summary: "When defining '%{relation}' with a :dependent => :restrict_with_error,
            Mongoid will raise an error when attempting to destroy the
            %{document} when the child '%{relation}' still has documents in it."
          resolution: "Don't attempt to delete the parent %{document} when
            it has children, or change the dependent option on the association."
        client_session_mismatch:
          message: "%{model} used within another client's session"
          summary: >
            Each model is associated with a client. Each session (transaction)
            is also associated with a client. You've attempted to create or
            update a model within a session associated with a different client.
            This may be a bug in your code.
          resolution: >
            Either process the %{model} model outside the enclosing
            transaction, or open a new transaction for that model before
            performing the create/update.