File tree 1 file changed +2
-3
lines changed
1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change 15
15
from time import sleep
16
16
17
17
from google .cloud import firestore
18
- from google .cloud .firestore_v1 import ArrayRemove , ArrayUnion
19
18
import google .cloud .exceptions
20
19
21
20
@@ -319,10 +318,10 @@ def update_doc_array():
319
318
city_ref = db .collection (u'cities' ).document (u'DC' )
320
319
321
320
# 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' ])})
323
322
324
323
# // 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' ])})
326
325
# [END fs_update_doc_array]
327
326
city = city_ref .get ()
328
327
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