We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c438ba1 commit e474a32Copy full SHA for e474a32
firestore/cloud-client/snippets.py
@@ -15,7 +15,6 @@
15
from time import sleep
16
17
from google.cloud import firestore
18
-import google.cloud.exceptions
19
20
21
def quickstart_new_instance():
@@ -217,10 +216,10 @@ def get_check_exists():
217
216
# [START get_check_exists]
218
doc_ref = db.collection(u'cities').document(u'SF')
219
220
- try:
221
- doc = doc_ref.get()
+ doc = doc_ref.get()
+ if doc.exists:
222
print(u'Document data: {}'.format(doc.to_dict()))
223
- except google.cloud.exceptions.NotFound:
+ else:
224
print(u'No such document!')
225
# [END get_check_exists]
226
0 commit comments