Class: Mongoid::Matchable::Nor
- Defined in:
- lib/mongoid/matchable/nor.rb
Overview
Defines behavior for handling $nor expressions in embedded documents.
Instance Attribute Summary
Attributes inherited from Default
Instance Method Summary collapse
-
#_matches?(conditions) ⇒ true, false
Does the supplied query match the attribute?.
Methods inherited from Default
Constructor Details
This class inherits a constructor from Mongoid::Matchable::Default
Instance Method Details
#_matches?(conditions) ⇒ true, false
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.
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# 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 |