Exception: Mongoid::Errors::InvalidExpressionOperator

Inherits:
InvalidQuery show all
Defined in:
build/mongoid-7.3/lib/mongoid/errors/invalid_expression_operator.rb

Overview

Raised when invalid expression-level operator is passed to an embedded matcher.

Constant Summary

Constants inherited from MongoidError

MongoidError::BASE_KEY

Instance Attribute Summary collapse

Attributes inherited from MongoidError

#problem, #resolution, #summary

Instance Method Summary collapse

Methods inherited from InvalidQuery

truncate_expr

Methods inherited from MongoidError

#compose_message

Constructor Details

#initialize(operator) ⇒ InvalidExpressionOperator

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates the exception.

Parameters:

  • operator (String)

    The operator that was used.



16
17
18
19
20
21
22
# File 'build/mongoid-7.3/lib/mongoid/errors/invalid_expression_operator.rb', line 16

def initialize(operator)
  @operator = operator
  super(compose_message("invalid_expression_operator",
    operator: operator,
    valid_operators: "'$and', '$nor', '$or'",
  ))
end

Instance Attribute Details

#operatorString (readonly)

Returns The operator that was used.

Returns:

  • (String)

    The operator that was used.



25
26
27
# File 'build/mongoid-7.3/lib/mongoid/errors/invalid_expression_operator.rb', line 25

def operator
  @operator
end