Module: Mongoid::Matcher::All Private

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

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.

Class Method Summary collapse

Class Method Details

.matches?(exists, value, condition) ⇒ 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:



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'build/mongoid-7.3/lib/mongoid/matcher/all.rb', line 6

module_function def matches?(exists, value, condition)
  unless Array === condition
    raise Errors::InvalidQuery, "$all argument must be an array: #{Errors::InvalidQuery.truncate_expr(condition)}"
  end

  !condition.empty? && condition.all? do |c|
    case c
    when ::Regexp, BSON::Regexp::Raw
      Regex.matches_array_or_scalar?(value, c)
    else
      EqImpl.matches?(true, value, c, '$all')
    end
  end
end