def __hash__(self):
        """ Collection name and id together make the hash; document class
        doesn't matter.

        Raises `TypeError` if collection or id is not set.
        """
        if self.collection and self.id:
            return hash(self.collection) | hash(self.id)
        raise TypeError('Document is unhashable: collection or id is not set')
def __hash__ ( self ) : if self . collection and self . id : return hash ( self . collection ) | hash ( self . id ) raise TypeError ( 'Document is unhashable: collection or id is not set' )
Collection name and id together make the hash; document class
        doesn't matter.

        Raises `TypeError` if collection or id is not set.