@@ -1171,6 +1171,7 @@ describe("firestore", () => {
11711171 } ) ;
11721172
11731173 describe ( "aggregate queries" , ( ) => {
1174+ < << << << HEAD
11741175 it ( "should fetch the count of documents in a collection" , async ( ) => {
11751176 const { collection, getCountFromServer } = require ( "firebase/firestore" ) ;
11761177 // [START count_aggregate_collection]
@@ -1189,6 +1190,24 @@ describe("firestore", () => {
11891190 console . log ( 'count: ' , snapshot . data ( ) . count ) ;
11901191 // [END count_aggregate_query]
11911192 } ) ;
1193+ = === ===
1194+ it ( "should fetch the count of documents in a collection" , async ( ) => {
1195+ // [START count_aggregate_collection]
1196+ const coll = collection ( db , "cities" ) ;
1197+ const snapshot = await getCountFromServer ( coll ) ;
1198+ console . log ( 'count: ' , snapshot . data ( ) . count ) ;
1199+ // [END count_aggregate_collection]
1200+ } ) ;
1201+
1202+ it ( "should fetch the count of documents in a query" , async ( ) => {
1203+ // [START count_aggregate_query]
1204+ const coll = collection ( db , "cities" ) ;
1205+ const query = query ( coll , where ( "state" , "==" , "CA" ) ) ;
1206+ const snapshot = await getCountFromServer ( query ) ;
1207+ console . log ( 'count: ' , snapshot . data ( ) . count ) ;
1208+ // [END count_aggregate_query]
1209+ } ) ;
1210+ > >>> >>> 09 d36f3 ( add simpler snippet )
11921211 } ) ;
11931212
11941213 // TODO: Break out into separate file
0 commit comments