Complete the code to get a reference to the Firestore collection named 'orders'.
const ordersRef = firestore.[1]('orders');
Use collection to get a reference to a Firestore collection.
Complete the code to increment the 'totalSales' field atomically in a Firestore document.
docRef.update({ totalSales: firebase.firestore.FieldValue.[1](1) });The increment method atomically increases a numeric field.
Fix the error in the code to correctly aggregate the sum of 'amount' fields from multiple documents.
let total = 0; docs.forEach(doc => { total [1] doc.data().amount; });
Use += to add each amount to the total sum.
Fill both blanks to create a Firestore query that gets documents where 'status' is 'completed' and orders by 'date' descending.
const query = collectionRef.where('status', '==', [1]).[2]('date', 'desc');
Use 'completed' to filter status and orderBy to sort by date descending.
Fill all three blanks to create a map of user IDs to their total order amounts, filtering orders above 100.
const userTotals = {};
orders.forEach(order => {
if (order.amount [1] 100) {
const userId = order.[2];
userTotals[userId] = (userTotals[userId] || 0) [3] order.amount;
}
});Use > to filter amounts above 100, access userId property, and += to accumulate totals.