Module: Mongoid::Matcher::ElemMatchExpression Private

Defined in:
build/mongoid-7.3/lib/mongoid/matcher/elem_match_expression.rb

Overview

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

$elemMatch argument can be a top-level expression and some specific operator combinations like $not with a regular expression.

Class Method Summary collapse

Class Method Details

.matches?(document, expr) ⇒ Boolean

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.

Returns:



9
10
11
12
13
14
15
16
17
# File 'build/mongoid-7.3/lib/mongoid/matcher/elem_match_expression.rb', line 9

module_function def matches?(document, expr)
  Expression.matches?(document, expr)
rescue Mongoid::Errors::InvalidExpressionOperator
  begin
    FieldExpression.matches?(true, document, expr)
  rescue Mongoid::Errors::InvalidFieldOperator => exc
    raise Mongoid::Errors::InvalidElemMatchOperator.new(exc.operator)
  end
end