module Mongoid::Matcher::And
@api private
Public Instance Methods
matches?(document, expr)
click to toggle source
# File lib/mongoid/matcher/and.rb, line 6 def matches?(document, expr) unless expr.is_a?(Array) raise Errors::InvalidQuery, "$and argument must be an array: #{Errors::InvalidQuery.truncate_expr(expr)}" end if expr.empty? raise Errors::InvalidQuery, "$and argument must be a non-empty array: #{Errors::InvalidQuery.truncate_expr(expr)}" end expr.all? do |sub_expr| Expression.matches?(document, sub_expr) end end