{"record":{"id":"49d3c075936c1072","repo":"mongodb/mongoid","slug":"in-argument-must-be-an-array-errors-invalidqu","errorCode":null,"errorMessage":"$in argument must be an array: #{Errors::InvalidQuery.truncate_expr(condition)}","messagePattern":"\\$in argument must be an array: #(.+?)","errorType":"exception","errorClass":"Mongoid::Errors::InvalidQuery","httpStatus":null,"severity":"error","filePath":"lib/mongoid/matcher/in.rb","lineNumber":20,"sourceCode":"  module Matcher\n    # In-memory matcher for $in expression.\n    #\n    # @see https://www.mongodb.com/docs/manual/reference/operator/query/in/\n    #\n    # @api private\n    module In\n      # Returns whether a value satisfies an $in expression.\n      #\n      # @param [ true | false ] exists Not used.\n      # @param [ Object ] value The value to check.\n      # @param [ Array<Object> ] condition The $in condition predicate.\n      #\n      # @return [ true | false ] Whether the value matches.\n      #\n      # @api private\n      module_function def matches?(_exists, value, condition)\n        unless condition.is_a?(Array)\n          raise Errors::InvalidQuery, \"$in argument must be an array: #{Errors::InvalidQuery.truncate_expr(condition)}\"\n        end\n\n        if value.is_a?(Array) && value.any? do |v|\n          condition.any? do |c|\n            EqImplWithRegexp.matches?('$in', v, c)\n          end\n        end\n          return true\n        end\n\n        condition.any? do |c|\n          EqImplWithRegexp.matches?('$in', value, c)\n        end\n      end\n    end\n  end\nend\n","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/matcher/in.rb#L2-L38","documentation":"Error \"$in argument must be an array: #{Errors::InvalidQuery.truncate_expr(condition)}\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/matcher/in.rb:20 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"}