{"record":{"id":"06236591886c4db9","repo":"mongodb/mongoid","slug":"could-not-find-a-document-of-class-klass","errorCode":null,"errorMessage":"Could not find a document of class %{klass}.","messagePattern":"Could not find a document of class %(.+?)\\.","errorType":"exception","errorClass":"Mongoid::Errors::DocumentNotFound","httpStatus":404,"severity":"error","filePath":"lib/mongoid/contextual/memory.rb","lineNumber":784,"sourceCode":"\n      # Pluck the field values from the given document.\n      #\n      # @param [ Document ] doc The document to pluck from.\n      # @param [ [ String | Symbol ]... ] *fields Field(s) to pluck.\n      #\n      # @return [ Object | Array<Object> ] The plucked values.\n      def pluck_from_doc(doc, *fields)\n        if fields.length == 1\n          retrieve_value_at_path(doc, fields.first)\n        else\n          fields.map do |field|\n            retrieve_value_at_path(doc, field)\n          end\n        end\n      end\n\n      def raise_document_not_found_error\n        raise Errors::DocumentNotFound.new(klass, nil, nil)\n      end\n    end\n  end\nend\n","sourceCodeStart":766,"sourceCodeEnd":789,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/contextual/memory.rb#L766-L789","documentation":"Error \"Could not find a document of class %{klass}.\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/contextual/memory.rb:784 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"}