Complete the code to get a reference to the collection named 'users'.
const usersCollection = firestore.collection([1]);The collection name must be a string. Using quotes around 'users' is correct.
Complete the code to fetch all documents from the 'users' collection.
const snapshot = await usersCollection.[1]();The correct method to fetch all documents from a collection in Firebase Firestore is get().
Fix the error in the code to loop through all documents in the snapshot.
snapshot.forEach(doc => [1](doc.data()));To print data to the console in JavaScript, use console.log.
Fill both blanks to create a map of document IDs to their data.
const dataMap = {};
snapshot.forEach(doc => {
dataMap[doc.[1]] = doc.[2]();
});Each document has an id property and a data() method to get its data.
Fill all three blanks to filter documents with age greater than 18 and map their names.
const adults = snapshot.docs .filter(doc => doc.data().[1] [2] [3]) .map(doc => doc.data().name);
We filter documents where the 'age' field is greater than 18, then map to get their 'name'.
