{"record":{"id":"76da8dc1259b0720","repo":"mongodb/mongoid","slug":"document-not-found-for-class-klass-with-attribu","errorCode":null,"errorMessage":"Document not found for class %{klass} with attributes %{attributes}.","messagePattern":"Document not found for class %(.+?) with attributes %(.+?)\\.","errorType":"exception","errorClass":"Mongoid::Errors::DocumentNotFound","httpStatus":404,"severity":"error","filePath":"lib/mongoid/association/nested/many.rb","lineNumber":210,"sourceCode":"          elsif association.embedded?\n            raise Errors::DocumentNotFound.new(association.klass, id)\n          elsif association.is_a?(Association::Referenced::HasAndBelongsToMany) || Mongoid.allow_reparenting_via_nested_attributes?\n            unless destroyable?(attrs)\n              Mongoid::Warnings.warn_reparenting_via_nested_attributes if Mongoid.allow_reparenting_via_nested_attributes?\n\n              # push existing document to association\n              doc = association.klass.unscoped.find(converted)\n              # find returns nil instead of raising when\n              # Mongoid.raise_not_found_error is false; a missing document\n              # must still be an error here, consistent with the other\n              # not-found branches.\n              raise Errors::DocumentNotFound.new(association.klass, id) if doc.nil?\n\n              update_document(doc, attrs)\n              existing.push(doc)\n            end\n          else\n            raise Errors::DocumentNotFound.new(association.klass, { _id: id, association.foreign_key => parent.id })\n          end\n\n          parent.children_may_have_changed!\n        end\n      end\n    end\n  end\nend\n","sourceCodeStart":192,"sourceCodeEnd":219,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/association/nested/many.rb#L192-L219","documentation":"Error \"Document not found for class %{klass} with attributes %{attributes}.\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/association/nested/many.rb:210 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"}