@@ -52,7 +52,7 @@ import {
52
52
refEqual ,
53
53
queryEqual ,
54
54
collectionGroup ,
55
- getQuery ,
55
+ getDocs ,
56
56
orderBy ,
57
57
startAfter ,
58
58
query ,
@@ -373,7 +373,7 @@ describe('WriteBatch', () => {
373
373
batch . set ( doc ( coll ) , { doc : 2 } ) ;
374
374
await batch . commit ( ) ;
375
375
376
- // TODO(firestorelite): Verify collection contents once getQuery is added
376
+ // TODO(firestorelite): Verify collection contents once getDocs is added
377
377
} ) ;
378
378
} ) ;
379
379
@@ -780,14 +780,14 @@ describe('Query', () => {
780
780
781
781
it ( 'supports default query' , ( ) => {
782
782
return withTestCollectionAndInitialData ( [ { foo : 1 } ] , async collRef => {
783
- const result = await getQuery ( collRef ) ;
783
+ const result = await getDocs ( collRef ) ;
784
784
verifyResults ( result , { foo : 1 } ) ;
785
785
} ) ;
786
786
} ) ;
787
787
788
788
it ( 'supports empty results' , ( ) => {
789
789
return withTestCollectionAndInitialData ( [ ] , async collRef => {
790
- const result = await getQuery ( collRef ) ;
790
+ const result = await getDocs ( collRef ) ;
791
791
verifyResults ( result ) ;
792
792
} ) ;
793
793
} ) ;
@@ -797,7 +797,7 @@ describe('Query', () => {
797
797
[ { foo : 1 } , { foo : 2 } ] ,
798
798
async collRef => {
799
799
const query1 = query ( collRef , where ( 'foo' , '==' , 1 ) ) ;
800
- const result = await getQuery ( query1 ) ;
800
+ const result = await getDocs ( query1 ) ;
801
801
verifyResults ( result , { foo : 1 } ) ;
802
802
}
803
803
) ;
@@ -808,7 +808,7 @@ describe('Query', () => {
808
808
[ { foo : 1 } , { foo : 2 } ] ,
809
809
async collRef => {
810
810
const query1 = query ( collRef , where ( new FieldPath ( 'foo' ) , '==' , 1 ) ) ;
811
- const result = await getQuery ( query1 ) ;
811
+ const result = await getDocs ( query1 ) ;
812
812
verifyResults ( result , { foo : 1 } ) ;
813
813
}
814
814
) ;
@@ -819,7 +819,7 @@ describe('Query', () => {
819
819
[ { foo : 1 } , { foo : 2 } ] ,
820
820
async collRef => {
821
821
const query1 = query ( collRef , orderBy ( 'foo' ) ) ;
822
- const result = await getQuery ( query1 ) ;
822
+ const result = await getDocs ( query1 ) ;
823
823
verifyResults ( result , { foo : 1 } , { foo : 2 } ) ;
824
824
}
825
825
) ;
@@ -830,7 +830,7 @@ describe('Query', () => {
830
830
[ { foo : 1 } , { foo : 2 } ] ,
831
831
async collRef => {
832
832
const query1 = query ( collRef , orderBy ( 'foo' , 'asc' ) ) ;
833
- const result = await getQuery ( query1 ) ;
833
+ const result = await getDocs ( query1 ) ;
834
834
verifyResults ( result , { foo : 1 } , { foo : 2 } ) ;
835
835
}
836
836
) ;
@@ -841,7 +841,7 @@ describe('Query', () => {
841
841
[ { foo : 1 } , { foo : 2 } ] ,
842
842
async collRef => {
843
843
const query1 = query ( collRef , orderBy ( 'foo' , 'desc' ) ) ;
844
- const result = await getQuery ( query1 ) ;
844
+ const result = await getDocs ( query1 ) ;
845
845
verifyResults ( result , { foo : 2 } , { foo : 1 } ) ;
846
846
}
847
847
) ;
@@ -852,7 +852,7 @@ describe('Query', () => {
852
852
[ { foo : 1 } , { foo : 2 } ] ,
853
853
async collRef => {
854
854
const query1 = query ( collRef , orderBy ( 'foo' ) , limit ( 1 ) ) ;
855
- const result = await getQuery ( query1 ) ;
855
+ const result = await getDocs ( query1 ) ;
856
856
verifyResults ( result , { foo : 1 } ) ;
857
857
}
858
858
) ;
@@ -863,7 +863,7 @@ describe('Query', () => {
863
863
[ { foo : 1 } , { foo : 2 } , { foo : 3 } ] ,
864
864
async collRef => {
865
865
const query1 = query ( collRef , orderBy ( 'foo' ) , limitToLast ( 2 ) ) ;
866
- const result = await getQuery ( query1 ) ;
866
+ const result = await getDocs ( query1 ) ;
867
867
verifyResults ( result , { foo : 2 } , { foo : 3 } ) ;
868
868
}
869
869
) ;
@@ -874,7 +874,7 @@ describe('Query', () => {
874
874
[ { foo : 1 } , { foo : 2 } ] ,
875
875
async collRef => {
876
876
const query1 = query ( collRef , orderBy ( 'foo' ) , startAt ( 2 ) ) ;
877
- const result = await getQuery ( query1 ) ;
877
+ const result = await getDocs ( query1 ) ;
878
878
verifyResults ( result , { foo : 2 } ) ;
879
879
}
880
880
) ;
@@ -885,7 +885,7 @@ describe('Query', () => {
885
885
[ { foo : 1 } , { foo : 2 } ] ,
886
886
async collRef => {
887
887
const query1 = query ( collRef , orderBy ( 'foo' ) , startAfter ( 1 ) ) ;
888
- const result = await getQuery ( query1 ) ;
888
+ const result = await getDocs ( query1 ) ;
889
889
verifyResults ( result , { foo : 2 } ) ;
890
890
}
891
891
) ;
@@ -896,7 +896,7 @@ describe('Query', () => {
896
896
[ { foo : 1 } , { foo : 2 } ] ,
897
897
async collRef => {
898
898
const query1 = query ( collRef , orderBy ( 'foo' ) , endAt ( 1 ) ) ;
899
- const result = await getQuery ( query1 ) ;
899
+ const result = await getDocs ( query1 ) ;
900
900
verifyResults ( result , { foo : 1 } ) ;
901
901
}
902
902
) ;
@@ -907,7 +907,7 @@ describe('Query', () => {
907
907
[ { foo : 1 } , { foo : 2 } ] ,
908
908
async collRef => {
909
909
const query1 = query ( collRef , orderBy ( 'foo' ) , endBefore ( 2 ) ) ;
910
- const result = await getQuery ( query1 ) ;
910
+ const result = await getDocs ( query1 ) ;
911
911
verifyResults ( result , { foo : 1 } ) ;
912
912
}
913
913
) ;
@@ -918,12 +918,12 @@ describe('Query', () => {
918
918
[ { foo : 1 } , { foo : 2 } ] ,
919
919
async collRef => {
920
920
let query1 = query ( collRef , orderBy ( 'foo' ) , limit ( 1 ) ) ;
921
- let result = await getQuery ( query1 ) ;
921
+ let result = await getDocs ( query1 ) ;
922
922
verifyResults ( result , { foo : 1 } ) ;
923
923
924
924
// Pass the document snapshot from the previous result
925
925
query1 = query ( query1 , startAfter ( result . docs [ 0 ] ) ) ;
926
- result = await getQuery ( query1 ) ;
926
+ result = await getDocs ( query1 ) ;
927
927
verifyResults ( result , { foo : 2 } ) ;
928
928
}
929
929
) ;
@@ -945,7 +945,7 @@ describe('Query', () => {
945
945
await setDoc ( barDoc , { bar : 1 } ) ;
946
946
947
947
const query1 = collectionGroup ( collRef . firestore , collectionGroupId ) ;
948
- const result = await getQuery ( query1 ) ;
948
+ const result = await getDocs ( query1 ) ;
949
949
950
950
verifyResults ( result , { bar : 1 } , { foo : 1 } ) ;
951
951
} ) ;
@@ -1028,16 +1028,16 @@ describe('equality', () => {
1028
1028
const query1b = query ( collRef , limit ( 10 ) ) ;
1029
1029
const query2 = query ( collRef , limit ( 100 ) ) ;
1030
1030
1031
- const snap1a = await getQuery ( query1a ) ;
1032
- const snap1b = await getQuery ( query1b ) ;
1033
- const snap2 = await getQuery ( query2 ) ;
1031
+ const snap1a = await getDocs ( query1a ) ;
1032
+ const snap1b = await getDocs ( query1b ) ;
1033
+ const snap2 = await getDocs ( query2 ) ;
1034
1034
1035
1035
expect ( snapshotEqual ( snap1a , snap1b ) ) . to . be . true ;
1036
1036
expect ( snapshotEqual ( snap1a , snap2 ) ) . to . be . false ;
1037
1037
1038
1038
// Re-run the query with an additional result.
1039
1039
await addDoc ( collRef , { foo : 3 } ) ;
1040
- const snap1c = await getQuery ( query1a ) ;
1040
+ const snap1c = await getDocs ( query1a ) ;
1041
1041
expect ( snapshotEqual ( snap1a , snap1c ) ) . to . be . false ;
1042
1042
}
1043
1043
) ;
@@ -1047,14 +1047,14 @@ describe('equality', () => {
1047
1047
return withTestCollectionAndInitialData (
1048
1048
[ { foo : 1 } , { foo : 2 } ] ,
1049
1049
async collRef => {
1050
- const snap1a = await getQuery ( collRef ) ;
1051
- const snap1b = await getQuery ( collRef ) ;
1050
+ const snap1a = await getDocs ( collRef ) ;
1051
+ const snap1b = await getDocs ( collRef ) ;
1052
1052
expect ( snapshotEqual ( snap1a . docs [ 0 ] , snap1b . docs [ 0 ] ) ) . to . be . true ;
1053
1053
expect ( snapshotEqual ( snap1a . docs [ 0 ] , snap1a . docs [ 0 ] ) ) . to . be . true ;
1054
1054
1055
1055
// Modify the document and obtain the snapshot again.
1056
1056
await updateDoc ( snap1a . docs [ 0 ] . ref , { foo : 3 } ) ;
1057
- const snap3 = await getQuery ( collRef ) ;
1057
+ const snap3 = await getDocs ( collRef ) ;
1058
1058
expect ( snapshotEqual ( snap1a . docs [ 0 ] , snap3 . docs [ 0 ] ) ) . to . be . false ;
1059
1059
}
1060
1060
) ;
@@ -1088,7 +1088,7 @@ describe('withConverter() support', () => {
1088
1088
return withTestCollection ( async coll => {
1089
1089
coll = coll . withConverter ( postConverter ) ;
1090
1090
await setDoc ( doc ( coll , 'post1' ) , new Post ( 'post1' , 'author1' ) ) ;
1091
- const posts = await getQuery ( coll ) ;
1091
+ const posts = await getDocs ( coll ) ;
1092
1092
expect ( posts . size ) . to . equal ( 1 ) ;
1093
1093
expect ( posts . docs [ 0 ] . data ( ) ! . byline ( ) ) . to . equal ( 'post1, by author1' ) ;
1094
1094
} ) ;
0 commit comments