{"record":{"id":"6f57cf5a4993b5ef","repo":"mongodb/mongoid","slug":"criteria-where-requires-zero-or-one-arguments-giv","errorCode":null,"errorMessage":"Criteria#where requires zero or one arguments (given #{args.length})","messagePattern":"Criteria#where requires zero or one arguments \\(given #(.+?)\\)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/mongoid/criteria.rb","lineNumber":518,"sourceCode":"    # @example Add a javascript selection.\n    #   criteria.where(\"this.name == 'syd'\")\n    #\n    # @param [ [ Hash | String ]... ] *args The standard selection\n    #   or javascript string.\n    #\n    # @raise [ UnsupportedJavascript ] If provided a string and the criteria\n    #   is embedded.\n    #\n    # @return [ Criteria ] The cloned selectable.\n    def where(*args)\n      # Historically this method required exactly one argument.\n      # As of https://jira.mongodb.org/browse/MONGOID-4804 it also accepts\n      # zero arguments.\n      # The underlying where implementation that super invokes supports\n      # any number of arguments, but we don't presently allow multiple\n      # arguments through this method. This API can be reconsidered in the\n      # future.\n      raise ArgumentError, \"Criteria#where requires zero or one arguments (given #{args.length})\" if args.length > 1\n\n      if args.length == 1\n        expression = args.first\n        raise Errors::UnsupportedJavascript.new(klass, expression) if expression.is_a?(::String) && embedded?\n      end\n      super\n    end\n\n    # Get a version of this criteria without the options.\n    #\n    # @example Get the criteria without options.\n    #   criteria.without_options\n    #\n    # @return [ Criteria ] The cloned criteria.\n    def without_options\n      crit = clone\n      crit.options.clear\n      crit","sourceCodeStart":500,"sourceCodeEnd":536,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/criteria.rb#L500-L536","documentation":"Error \"Criteria#where requires zero or one arguments (given #{args.length})\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/criteria.rb:518 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"}