'Return the hash based on the PK of this document. If it\'s new
and doesn\'t have a PK yet, return the default object hash instead.'

def __hash__(self):

    if (self.pk is None):
        return super(BaseDocument, self).__hash__()
    else:
        return hash(self.pk)
