mongodb/mongoid · error · NotImplementedError

NotImplementedError

Error message

NotImplementedError

What it means

Error "NotImplementedError" thrown in mongodb/mongoid.

Source

Thrown at lib/mongoid/association/eager_load/polymorphic_targets.rb:50

          private

          # Whether the type's model shares the root's database (and client): exactly
          # what a $lookup from the root collection can reach.
          def in_root_database?(association, type, root_class)
            model = association.resolver.model_for(type)
            model.client_name == root_class.client_name &&
              model.database_name == root_class.database_name
          end
        end

        def initialize(association, keys_by_type)
          @association = association
          @keys_by_type = keys_by_type
        end

        # @return [ Hash ] The targets, as { type => { primary_key => document } }.
        def fetch
          raise NotImplementedError
        end

        private

        def primary_key
          @association.primary_key
        end

        def model_for(type)
          @association.resolver.model_for(type)
        end

        # The raw documents instantiated and indexed by their primary key.
        def indexed(documents, model)
          documents.map { |document| Factory.from_db(model, document) }
                   .index_by { |document| document.send(primary_key) }
        end
      end

View on GitHub (pinned to 0da0e23d71)

When it happens

Trigger: Thrown at lib/mongoid/association/eager_load/polymorphic_targets.rb:50 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mongodb/mongoid@0da0e23d71 (2026-08-23). Data as JSON: /api/errors/e814c9140e2a2cbe. Report an issue: GitHub.