{"record":{"id":"8cef3cfa7301c8e7","repo":"mongodb/mongoid","slug":"invalid-options-passed-to-klass-store-in-opt","errorCode":null,"errorMessage":"Invalid options passed to %{klass}.store_in: %{options}.","messagePattern":"Invalid options passed to %(.+?)\\.store_in: %(.+?)\\.","errorType":"exception","errorClass":"Mongoid::Errors::InvalidStorageOptions","httpStatus":null,"severity":"error","filePath":"lib/mongoid/clients/validators/storage.rb","lineNumber":21,"sourceCode":"module Mongoid\n  module Clients\n    module Validators\n      # Validates the options passed to :store_in.\n      module Storage\n        extend self\n\n        # The valid options for storage.\n        VALID_OPTIONS = %i[collection collection_options database client].freeze\n\n        # Validate the options provided to :store_in.\n        #\n        # @example Validate the options.\n        #   Storage.validate(:collection_name)\n        #\n        # @param [ Class ] klass The model class.\n        # @param [ Hash | String | Symbol ] options The provided options.\n        def validate(klass, options)\n          valid_keys?(options) or raise Errors::InvalidStorageOptions.new(klass, options)\n        end\n\n        private\n\n        # Determine if all keys in the options hash are valid.\n        #\n        # @api private\n        #\n        # @example Are all keys valid?\n        #   validator.valid_keys?({ collection: \"name\" })\n        #\n        # @param [ Hash ] options The options hash.\n        #\n        # @return [ true | false ] If all keys are valid.\n        def valid_keys?(options)\n          return false unless options.is_a?(::Hash)\n\n          options.keys.all? do |key|","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/clients/validators/storage.rb#L3-L39","documentation":"Error \"Invalid options passed to %{klass}.store_in: %{options}.\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/clients/validators/storage.rb:21 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0da0e23d71adfbad31128c18e5e2c8c301c6f7c4","analyzedAt":"2026-08-23T06:25:47.656Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}