Skip to content
7 changes: 4 additions & 3 deletions google/cloud/firestore_v1/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,8 @@ def on_snapshot(self, callback):
provided callback is run on the snapshot of the documents.

Args:
callback (Callable[[:class:`~google.cloud.firestore.collection.CollectionSnapshot`], NoneType]):
callback (Callable[List[:class:`~google.cloud.firestore_v1.collection.CollectionSnapshot`], \
List[:class:`~google.cloud.firestore_v1.watch.DocumentChange`], datetime.datetime], NoneType):
a callback to run when a change occurs.

Example:
Expand All @@ -468,8 +469,8 @@ def on_snapshot(self, callback):
db = firestore_v1.Client()
collection_ref = db.collection(u'users')

def on_snapshot(collection_snapshot, changes, read_time):
for doc in collection_snapshot.documents:
def on_snapshot(docs, changes, read_time):
for doc in docs:
print(u'{} => {}'.format(doc.id, doc.to_dict()))

# Watch this collection
Expand Down
9 changes: 5 additions & 4 deletions google/cloud/firestore_v1/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,8 @@ def on_snapshot(self, callback):
provided callback is run on the snapshot.

Args:
callback(Callable[[:class:`~google.cloud.firestore.document.DocumentSnapshot`], NoneType]):
callback (Callable[List[:class:`~google.cloud.firestore_v1.document.DocumentSnapshot`], \
List[:class:`~google.cloud.firestore_v1.watch.DocumentChange`], datetime.datetime], NoneType):
a callback to run when a change occurs

Example:
Expand All @@ -512,9 +513,9 @@ def on_snapshot(self, callback):
db = firestore_v1.Client()
collection_ref = db.collection(u'users')

def on_snapshot(document_snapshot, changes, read_time):
doc = document_snapshot
print(u'{} => {}'.format(doc.id, doc.to_dict()))
def on_snapshot(docs, changes, read_time):
for doc in docs:
print(u'{} => {}'.format(doc.id, doc.to_dict()))

doc_ref = db.collection(u'users').document(
u'alovelace' + unique_resource_id())
Expand Down
3 changes: 2 additions & 1 deletion google/cloud/firestore_v1/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,8 @@ def on_snapshot(self, callback):
provided callback is run on the snapshot of the documents.

Args:
callback(Callable[[:class:`~google.cloud.firestore.query.QuerySnapshot`], NoneType]):
callback (Callable[List[:class:`~google.cloud.firestore_v1.query.QuerySnapshot`], \
List[:class:`~google.cloud.firestore_v1.watch.DocumentChange`], datetime.datetime], NoneType):
a callback to run when a change occurs.

Example:
Expand Down