module Mongoid::Equality

def <=>(other)

Other tags:
    Since: - 1.0.0

Returns:
  • (Integer) - -1, 0, 1.

Parameters:
  • other (Document) -- The document to compare with.

Other tags:
    Example: Compare two documents. -
def <=>(other)
  attributes["_id"].to_s <=> other.attributes["_id"].to_s
end

def ==(other)

Other tags:
    Since: - 1.0.0

Returns:
  • (true, false) - True if the ids are equal, false if not.

Parameters:
  • other (Document, Object) -- The other object to compare with.

Other tags:
    Example: Compare for equality. -
def ==(other)
  self.class == other.class &&
      attributes["_id"] == other.attributes["_id"]
end

def ===(other)

Other tags:
    Since: - 1.0.0

Returns:
  • (true, false) - True if the classes are equal, false if not.

Parameters:
  • other (Document, Object) -- The other object to compare with.

Other tags:
    Example: Compare the classes. -
def ===(other)
  other.class == Class ? self.class === other : self == other
end

def eql?(other)

Other tags:
    Since: - 1.0.0

Returns:
  • (true, false) - True if equal, false if not.

Parameters:
  • other (Document, Object) -- The object to check against.

Other tags:
    Example: Perform equality checking. -
def eql?(other)
  self == (other)
end