{"record":{"id":"e814c9140e2a2cbe","repo":"mongodb/mongoid","slug":"notimplementederror-e814c9","errorCode":null,"errorMessage":"NotImplementedError","messagePattern":"NotImplementedError","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"lib/mongoid/association/eager_load/polymorphic_targets.rb","lineNumber":50,"sourceCode":"          private\n\n          # Whether the type's model shares the root's database (and client): exactly\n          # what a $lookup from the root collection can reach.\n          def in_root_database?(association, type, root_class)\n            model = association.resolver.model_for(type)\n            model.client_name == root_class.client_name &&\n              model.database_name == root_class.database_name\n          end\n        end\n\n        def initialize(association, keys_by_type)\n          @association = association\n          @keys_by_type = keys_by_type\n        end\n\n        # @return [ Hash ] The targets, as { type => { primary_key => document } }.\n        def fetch\n          raise NotImplementedError\n        end\n\n        private\n\n        def primary_key\n          @association.primary_key\n        end\n\n        def model_for(type)\n          @association.resolver.model_for(type)\n        end\n\n        # The raw documents instantiated and indexed by their primary key.\n        def indexed(documents, model)\n          documents.map { |document| Factory.from_db(model, document) }\n                   .index_by { |document| document.send(primary_key) }\n        end\n      end","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/association/eager_load/polymorphic_targets.rb#L32-L68","documentation":"Error \"NotImplementedError\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/association/eager_load/polymorphic_targets.rb:50 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"}