{"record":{"id":"b81135e3ab114e83","repo":"mongodb/mongoid","slug":"errors-documentnotfound-new-klass-ids-ids-res","errorCode":null,"errorMessage":"Errors::DocumentNotFound.new(klass, ids, ids - result.map(&:_id))","messagePattern":"Errors::DocumentNotFound\\.new\\(klass, ids, ids - result\\.map\\(&:_id\\)\\)","errorType":"exception","errorClass":"Mongoid::Errors::DocumentNotFound","httpStatus":404,"severity":"error","filePath":"lib/mongoid/criteria.rb","lineNumber":582,"sourceCode":"    private\n\n    # Are documents in the query missing, and are we configured to raise an\n    # error?\n    #\n    # @api private\n    #\n    # @example Check for missing documents.\n    #   criteria.check_for_missing_documents!([], [ 1 ])\n    #\n    # @param [ Array<Document> ] result The result.\n    # @param [ Array<Object> ] ids The ids.\n    #\n    # @raise [ Errors::DocumentNotFound ] If none are found and raising an\n    #   error.\n    def check_for_missing_documents!(result, ids)\n      return unless (result.size < ids.size) && Mongoid.raise_not_found_error\n\n      raise Errors::DocumentNotFound.new(klass, ids, ids - result.map(&:_id))\n    end\n\n    # Clone or dup the current +Criteria+. This will return a new criteria with\n    # the selector, options, klass, embedded options, etc intact.\n    #\n    # @api private\n    #\n    # @example Clone a criteria.\n    #   criteria.clone\n    #\n    # @example Dup a criteria.\n    #   criteria.dup\n    #\n    # @param [ Criteria ] other The criteria getting cloned.\n    #\n    # @return [ nil ] nil.\n    def initialize_copy(other)\n      @inclusions = other.inclusions.dup","sourceCodeStart":564,"sourceCodeEnd":600,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/criteria.rb#L564-L600","documentation":"Error \"Errors::DocumentNotFound.new(klass, ids, ids - result.map(&:_id))\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/criteria.rb:582 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"}