class Mongoid::Matchable::Nor
Defines behavior for handling $nor expressions in embedded documents.
Public Instance Methods
_matches?(conditions)
click to toggle source
Does the supplied query match the attribute?
Note: an empty array as an argument to $nor is prohibited by MongoDB server. Mongoid
does allow this and returns false in this case.
@example Does this match?
matcher._matches?("$nor" => [ { field => value } ])
@param [ Array ] conditions The or expression.
@return [ true, false ] True if matches, false if not.
@since 6.4.2/7.0.2/7.1.0
# File lib/mongoid/matchable/nor.rb, line 22 def _matches?(conditions) if conditions.length == 0 # MongoDB does not allow $nor array to be empty, but # Mongoid accepts an empty array for $or which MongoDB also # prohibits return false end conditions.none? do |condition| condition.all? do |key, value| document._matches?(key => value) end end end