Skip to content

Commit c9337cd

Browse files
jlara310BenWhitehead
authored andcommitted
Adjust update_doc_array snippet to not require an extra import (#2306)
1 parent 0170893 commit c9337cd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

firestore/cloud-client/snippets.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from time import sleep
1616

1717
from google.cloud import firestore
18-
from google.cloud.firestore_v1 import ArrayRemove, ArrayUnion
1918
import google.cloud.exceptions
2019

2120

@@ -319,10 +318,10 @@ def update_doc_array():
319318
city_ref = db.collection(u'cities').document(u'DC')
320319

321320
# Atomically add a new region to the 'regions' array field.
322-
city_ref.update({u'regions': ArrayUnion([u'greater_virginia'])})
321+
city_ref.update({u'regions': firestore.ArrayUnion([u'greater_virginia'])})
323322

324323
# // Atomically remove a region from the 'regions' array field.
325-
city_ref.update({u'regions': ArrayRemove([u'east_coast'])})
324+
city_ref.update({u'regions': firestore.ArrayRemove([u'east_coast'])})
326325
# [END fs_update_doc_array]
327326
city = city_ref.get()
328327
print(u'Updated the regions field of the DC. {}'.format(city.to_dict()))

0 commit comments

Comments
 (0)