Skip to content

Instantly share code, notes, and snippets.

View JoeArmani's full-sized avatar

Joe Armani JoeArmani

View GitHub Profile
@JoeArmani
JoeArmani / countTest.js
Last active January 17, 2024 14:20
Using Firestore's Count Aggregator
const countDocs = async () => {
try {
const shippedBoxesCountSnapshot = await db.collection('boxes')
.where('145971562', '==', 353358909)
.where('789843387', '==', 13)
.count()
.get();
console.log('shippedBoxesCountSnapshot', shippedBoxesCountSnapshot);
console.log('count:', shippedBoxesCountSnapshot.data().count);