Sha256: 876018e88cd8285be17189fce0cf3dbb42bbbc9633ca8453a7982bf7d81e3e5e

Contents?: true

Size: 852 Bytes

Versions: 14

Compression:

Stored size: 852 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

module Mongoid
  module Errors

    # Raised when invalid field-level operator is passed to the $elemMatch
    # embedded matcher.
    class InvalidElemMatchOperator < InvalidQuery

      # @api private
      VALID_OPERATORS = %w(
        and all eq exists gt gte in lt lte ne nin nor not or 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_elem_match_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_elem_match_operator.rb
mongoid-7.3.4 lib/mongoid/errors/invalid_elem_match_operator.rb
mongoid-7.2.6 lib/mongoid/errors/invalid_elem_match_operator.rb
mongoid-7.3.3 lib/mongoid/errors/invalid_elem_match_operator.rb
mongoid-7.3.2 lib/mongoid/errors/invalid_elem_match_operator.rb
mongoid-7.2.5 lib/mongoid/errors/invalid_elem_match_operator.rb
mongoid-7.2.4 lib/mongoid/errors/invalid_elem_match_operator.rb
mongoid-7.3.1 lib/mongoid/errors/invalid_elem_match_operator.rb
mongoid-7.3.0 lib/mongoid/errors/invalid_elem_match_operator.rb
mongoid-7.2.3 lib/mongoid/errors/invalid_elem_match_operator.rb
mongoid-7.2.2 lib/mongoid/errors/invalid_elem_match_operator.rb
mongoid-7.2.1 lib/mongoid/errors/invalid_elem_match_operator.rb
mongoid-7.2.0 lib/mongoid/errors/invalid_elem_match_operator.rb
mongoid-7.2.0.rc1 lib/mongoid/errors/invalid_elem_match_operator.rb