Sha256: 8af91242bee1c836d7d431b31b2a9b931625739b1d4d2406064274e9dc09c784
Contents?: true
Size: 1.08 KB
Versions: 16
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true # encoding: utf-8 module Mongoid module Matchable # Defines behavior for handling $nor expressions in embedded documents. class Nor < Default # 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 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 end end end
Version data entries
16 entries across 16 versions & 1 rubygems