Method: Mongoid::Criteria#==

Defined in:
lib/mongoid/criteria.rb

#==(other) ⇒ Object

Returns true if the supplied Enumerable or Criteria is equal to the results of this Criteria or the criteria itself.

This will force a database load when called if an enumerable is passed.

Options:

other: The other Enumerable or Criteria to compare to.



68
69
70
71
72
73
74
75
76
77
# File 'lib/mongoid/criteria.rb', line 68

def ==(other)
  case other
  when Criteria
    self.selector == other.selector && self.options == other.options
  when Enumerable
    return (execute.entries == other)
  else
    return false
  end
end