File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed
Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change 1515from time import sleep
1616
1717from google .cloud import firestore
18- from google .cloud .firestore_v1 import ArrayRemove , ArrayUnion
1918import 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 ()))
You can’t perform that action at this time.
0 commit comments