Sha256: 66cc8c556635c67b30adbe45254c11c1d8834e821d1e7477e556e2662ce3e1d1

Contents?: true

Size: 830 Bytes

Versions: 14

Compression:

Stored size: 830 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

module Mongoid
  module Errors

    # Raised when invalid field-level operator is passed to an
    # embedded matcher.
    class InvalidFieldOperator < InvalidQuery

      # @api private
      VALID_OPERATORS = %w(
        all elemMatch eq exists gt gte in lt lte ne nin not regex size
      ).freeze

      # Creates the exception.
      #
      # @param [ String ] operator The operator that was used.
      #
      # @api private
      def initialize(operator)
        @operator = operator
        super(compose_message("invalid_field_operator",
          operator: operator,
          valid_operators: VALID_OPERATORS.map { |op| "'$#{op}'" }.join(', '),
        ))
      end

      # @return [ String ] The operator that was used.
      attr_reader :operator
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mongoid-7.3.5 lib/mongoid/errors/invalid_field_operator.rb
mongoid-7.3.4 lib/mongoid/errors/invalid_field_operator.rb
mongoid-7.2.6 lib/mongoid/errors/invalid_field_operator.rb
mongoid-7.3.3 lib/mongoid/errors/invalid_field_operator.rb
mongoid-7.3.2 lib/mongoid/errors/invalid_field_operator.rb
mongoid-7.2.5 lib/mongoid/errors/invalid_field_operator.rb
mongoid-7.2.4 lib/mongoid/errors/invalid_field_operator.rb
mongoid-7.3.1 lib/mongoid/errors/invalid_field_operator.rb
mongoid-7.3.0 lib/mongoid/errors/invalid_field_operator.rb
mongoid-7.2.3 lib/mongoid/errors/invalid_field_operator.rb
mongoid-7.2.2 lib/mongoid/errors/invalid_field_operator.rb
mongoid-7.2.1 lib/mongoid/errors/invalid_field_operator.rb
mongoid-7.2.0 lib/mongoid/errors/invalid_field_operator.rb
mongoid-7.2.0.rc1 lib/mongoid/errors/invalid_field_operator.rb