File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -1160,9 +1160,17 @@ describe("firestore", () => {
1160
1160
1161
1161
describe ( "aggregate queries" , ( ) => {
1162
1162
it ( "should fetch the count of documents in a collection" , async ( ) => {
1163
+ // [START count_aggregate_collection]
1164
+ const coll = collection ( db , "cities" ) ;
1165
+ const snapshot = await getCountFromServer ( coll ) ;
1166
+ console . log ( 'count: ' , snapshot . data ( ) . count ) ;
1167
+ // [END count_aggregate_collection]
1168
+ } ) ;
1169
+
1170
+ it ( "should fetch the count of documents in a query" , async ( ) => {
1163
1171
// [START count_aggregate_query]
1164
- const coll = collection ( db , "games/chess/players " ) ;
1165
- const query = query ( coll , where ( "online " , "==" , true ) ) ;
1172
+ const coll = collection ( db , "cities " ) ;
1173
+ const query = query ( coll , where ( "state " , "==" , "CA" ) ) ;
1166
1174
const snapshot = await getCountFromServer ( query ) ;
1167
1175
console . log ( 'count: ' , snapshot . data ( ) . count ) ;
1168
1176
// [END count_aggregate_query]
You can’t perform that action at this time.
0 commit comments