Method: Mongoid::Document#hash

Defined in:
lib/mongoid/document.rb

#hashInteger

Delegates to identity in order to allow two records of the same identity to work with something like:

[ Person.find(1), Person.find(2), Person.find(3) ] &
[ Person.find(1), Person.find(4) ] # => [ Person.find(1) ]

Examples:

Get the hash.

document.hash

Returns:

  • (Integer)

    The hash of the document’s identity.



75
76
77
# File 'lib/mongoid/document.rb', line 75

def hash
  identity.hash
end