Skip to content

Commit f230df3

Browse files
committed
add simpler snippet
1 parent fbdc32b commit f230df3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

firestore-next/test.firestore.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff 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]

0 commit comments

Comments
 (0)