diff --git a/google/cloud/firestore_v1/collection.py b/google/cloud/firestore_v1/collection.py index f6e5ffa14..c78e44929 100644 --- a/google/cloud/firestore_v1/collection.py +++ b/google/cloud/firestore_v1/collection.py @@ -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: @@ -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 diff --git a/google/cloud/firestore_v1/document.py b/google/cloud/firestore_v1/document.py index 571315e87..b431e26da 100644 --- a/google/cloud/firestore_v1/document.py +++ b/google/cloud/firestore_v1/document.py @@ -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: @@ -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()) diff --git a/google/cloud/firestore_v1/query.py b/google/cloud/firestore_v1/query.py index 1b729a208..6fca2a2c0 100644 --- a/google/cloud/firestore_v1/query.py +++ b/google/cloud/firestore_v1/query.py @@ -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: