mongodb/mongoid · error · Mongoid::Errors::InMemoryCollationNotSupported

A collation option cannot be applied when querying documents

Error message

A collation option cannot be applied when querying documents in-memory.

What it means

Error "A collation option cannot be applied when querying documents in-memory." thrown in mongodb/mongoid.

Source

Thrown at lib/mongoid/contextual/memory.rb:623

      # @api private
      #
      # @example Set the skipping value.
      #
      # @param [ Integer ] value The skip.
      #
      # @return [ Integer ] The skip.
      attr_writer :skipping

      # Apply criteria options.
      #
      # @api private
      #
      # @example Apply criteria options.
      #   context.apply_options
      #
      # @return [ Memory ] self.
      def apply_options
        raise Errors::InMemoryCollationNotSupported.new if criteria.options[:collation]

        skip(criteria.options[:skip]).limit(criteria.options[:limit])
      end

      # Map the sort symbols to the correct MongoDB values.
      #
      # @example Apply the sorting params.
      #   context.apply_sorting
      def apply_sorting
        return unless spec = criteria.options[:sort]

        in_place_sort(spec)
      end

      # Compare two values, handling the cases when
      # either value is nil.
      #
      # @api private

View on GitHub (pinned to 0da0e23d71)

When it happens

Trigger: Thrown at lib/mongoid/contextual/memory.rb:623 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/967eb88b4b385128. Report an issue: GitHub.