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", () => {
11601160
11611161 describe ( "aggregate queries" , ( ) => {
11621162 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 ( ) => {
11631171 // [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" ) ) ;
11661174 const snapshot = await getCountFromServer ( query ) ;
11671175 console . log ( 'count: ' , snapshot . data ( ) . count ) ;
11681176 // [END count_aggregate_query]
You can’t perform that action at this time.
0 commit comments