{"record":{"id":"5997e2721d010988","repo":"mongodb/mongoid","slug":"unknown-type-argument-condition","errorCode":null,"errorMessage":"Unknown $type argument: #{condition}","messagePattern":"Unknown \\$type argument: #(.+?)","errorType":"exception","errorClass":"Mongoid::Errors::InvalidQuery","httpStatus":null,"severity":"error","filePath":"lib/mongoid/matcher/type.rb","lineNumber":26,"sourceCode":"    module Type\n      # Returns whether a value satisfies a $type expression.\n      #\n      # @param [ true | false ] exists Whether the value exists.\n      # @param [ Object ] value The value to check.\n      # @param [ Integer | Array<Integer> ] condition The $type condition\n      #   predicate which corresponds to the BSON type enumeration.\n      #\n      # @return [ true | false ] Whether the value matches.\n      #\n      # @api private\n      module_function def matches?(exists, value, condition)\n        conditions = case condition\n                     when Array\n                       condition\n                     when Integer\n                       [ condition ]\n                     else\n                       raise Errors::InvalidQuery, \"Unknown $type argument: #{condition}\"\n                     end\n        conditions.each do |condition|\n          return true if one_matches?(exists, value, condition)\n        end\n        false\n      end\n\n      # Returns whether a value satisfies a single $type expression\n      # value.\n      #\n      # @param [ true | false ] exists Whether the value exists.\n      # @param [ Object ] value The value to check.\n      # @param [ Integer ] condition The $type condition predicate\n      #   which corresponds to the BSON type enumeration.\n      #\n      # @return [ true | false ] Whether the value matches.\n      #\n      # @api private","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/matcher/type.rb#L8-L44","documentation":"Raised by Mongoid::Matcher::Type.matches? when the $type condition contains a value that is not a recognized BSON type number (or alias form supported by the server). The faulting input is the unknown condition passed as the $type argument.","triggerScenarios":"Thrown at lib/mongoid/matcher/type.rb:26 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use valid BSON type codes (e.g. 1 for Double, 2 for String) or aliases like 'string', 'int'","Check the MongoDB $type documentation for the full list of accepted type identifiers"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0da0e23d71adfbad31128c18e5e2c8c301c6f7c4","analyzedAt":"2026-08-23T06:25:47.656Z","contentChangedAt":"2026-08-23T06:25:47.656Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}