@@ -59,7 +59,7 @@ def quickstart_get_collection():
59
59
db = firestore .Client ()
60
60
# [START quickstart_get_collection]
61
61
users_ref = db .collection (u'users' )
62
- docs = users_ref .get ()
62
+ docs = users_ref .stream ()
63
63
64
64
for doc in docs :
65
65
print (u'{} => {}' .format (doc .id , doc .to_dict ()))
@@ -240,7 +240,7 @@ def get_custom_class():
240
240
def get_simple_query ():
241
241
db = firestore .Client ()
242
242
# [START get_simple_query]
243
- docs = db .collection (u'cities' ).where (u'capital' , u'==' , True ).get ()
243
+ docs = db .collection (u'cities' ).where (u'capital' , u'==' , True ).stream ()
244
244
245
245
for doc in docs :
246
246
print (u'{} => {}' .format (doc .id , doc .to_dict ()))
@@ -254,15 +254,15 @@ def array_contains_filter():
254
254
255
255
query = cities_ref .where (u'regions' , u'array_contains' , u'west_coast' )
256
256
# [END fs_array_contains_filter]
257
- docs = query .get ()
257
+ docs = query .stream ()
258
258
for doc in docs :
259
259
print (u'{} => {}' .format (doc .id , doc .to_dict ()))
260
260
261
261
262
262
def get_full_collection ():
263
263
db = firestore .Client ()
264
264
# [START get_full_collection]
265
- docs = db .collection (u'cities' ).get ()
265
+ docs = db .collection (u'cities' ).stream ()
266
266
267
267
for doc in docs :
268
268
print (u'{} => {}' .format (doc .id , doc .to_dict ()))
@@ -520,7 +520,7 @@ def compound_query_invalid_multi_field():
520
520
def order_simple_limit ():
521
521
db = firestore .Client ()
522
522
# [START order_simple_limit]
523
- db .collection (u'cities' ).order_by (u'name' ).limit (3 ).get ()
523
+ db .collection (u'cities' ).order_by (u'name' ).limit (3 ).stream ()
524
524
# [END order_simple_limit]
525
525
526
526
@@ -530,7 +530,7 @@ def order_simple_limit_desc():
530
530
cities_ref = db .collection (u'cities' )
531
531
query = cities_ref .order_by (
532
532
u'name' , direction = firestore .Query .DESCENDING ).limit (3 )
533
- results = query .get ()
533
+ results = query .stream ()
534
534
# [END order_simple_limit_desc]
535
535
print (results )
536
536
@@ -550,7 +550,7 @@ def order_where_limit():
550
550
cities_ref = db .collection (u'cities' )
551
551
query = cities_ref .where (
552
552
u'population' , u'>' , 2500000 ).order_by (u'population' ).limit (2 )
553
- results = query .get ()
553
+ results = query .stream ()
554
554
# [END order_where_limit]
555
555
print (results )
556
556
@@ -561,7 +561,7 @@ def order_where_valid():
561
561
cities_ref = db .collection (u'cities' )
562
562
query = cities_ref .where (
563
563
u'population' , u'>' , 2500000 ).order_by (u'population' )
564
- results = query .get ()
564
+ results = query .stream ()
565
565
# [END order_where_valid]
566
566
print (results )
567
567
@@ -571,7 +571,7 @@ def order_where_invalid():
571
571
# [START order_where_invalid]
572
572
cities_ref = db .collection (u'cities' )
573
573
query = cities_ref .where (u'population' , u'>' , 2500000 ).order_by (u'country' )
574
- results = query .get ()
574
+ results = query .stream ()
575
575
# [END order_where_invalid]
576
576
print (results )
577
577
@@ -609,7 +609,7 @@ def snapshot_cursors():
609
609
start_at_snapshot = db .collection (
610
610
u'cities' ).order_by (u'population' ).start_at (snapshot )
611
611
# [END fs_start_at_snapshot_query_cursor]
612
- results = start_at_snapshot .limit (10 ).get ()
612
+ results = start_at_snapshot .limit (10 ).stream ()
613
613
for doc in results :
614
614
print (u'{}' .format (doc .id ))
615
615
@@ -623,7 +623,7 @@ def cursor_paginate():
623
623
first_query = cities_ref .order_by (u'population' ).limit (3 )
624
624
625
625
# Get the last document from the results
626
- docs = first_query .get ()
626
+ docs = first_query .stream ()
627
627
last_doc = list (docs )[- 1 ]
628
628
629
629
# Construct a new query starting at this document
@@ -802,7 +802,7 @@ def delete_full_collection():
802
802
803
803
# [START delete_full_collection]
804
804
def delete_collection (coll_ref , batch_size ):
805
- docs = coll_ref .limit (10 ).get ()
805
+ docs = coll_ref .limit (10 ).stream ()
806
806
deleted = 0
807
807
808
808
for doc in docs :
@@ -871,7 +871,7 @@ def collection_group_query(db):
871
871
# [START fs_collection_group_query]
872
872
museums = db .collection_group (u'landmarks' )\
873
873
.where (u'type' , u'==' , u'museum' )
874
- docs = museums .get ()
874
+ docs = museums .stream ()
875
875
for doc in docs :
876
876
print (u'{} => {}' .format (doc .id , doc .to_dict ()))
877
877
# [END fs_collection_group_query]
0 commit comments