This repository was archived by the owner on Mar 2, 2026. It is now read-only.
Description Environment details
OS type and version: 64-bit and Ubuntu 18.04.5 LTS
Python version: python 3.7
pip version: pip 21.1.3
google-cloud-firestore version: google-cloud-firestore 2.1.0
Steps to reproduce
Add some documents to Firestore and store the document snapshots in a variable ( say result )
Form a set of the fetched documents set(result)
Code example
from google .cloud import firestore
fs_client = firestore .Client ()
result = set ()
query = fs_client .collection_group (< collection - group - name > )
for document_snapshot in query .stream ():
result .add (document_snapshot )
Stack trace
File "<folder>/venv/lib/python3.7/site-packages/google/cloud/firestore_v1/base_document.py", line 372, in __hash__
seconds = int(self.update_time.timestamp())
AttributeError: timestamp
The same does not throw an error when we store DocumentReference objects in a set.
Also, modifying __hash__ as below works:
def __hash__ (self ):
seconds = int (self .update_time .seconds )
nanos = self .update_time .nanos
return hash (self ._reference ) + hash (seconds ) + hash (nanos ) Reactions are currently unavailable
Environment details
python 3.7pip 21.1.3google-cloud-firestore 2.1.0Steps to reproduce
result)set(result)Code example
Stack trace
The same does not throw an error when we store
DocumentReferenceobjects in a set.Also, modifying
__hash__as below works: