Recall & Review
beginner
What does 'Getting all documents in collection' mean in Firebase?
It means fetching every document stored inside a specific collection in Firestore, like getting all items from a folder.
Click to reveal answer
beginner
Which Firebase function is used to get all documents from a collection?
The function
getDocs() is used along with a collection reference to retrieve all documents.Click to reveal answer
beginner
How do you create a reference to a collection in Firebase Firestore?
Use
collection(db, 'collectionName') where db is your Firestore instance and 'collectionName' is the name of your collection.Click to reveal answer
intermediate
What type of data structure do you get after fetching all documents from a collection?
You get a
QuerySnapshot which contains multiple DocumentSnapshot objects, each representing a document.Click to reveal answer
intermediate
How can you access the data inside each document after fetching all documents?
You loop through the
QuerySnapshot using forEach and call doc.data() on each DocumentSnapshot to get the document's data.Click to reveal answer
Which function fetches all documents from a Firestore collection?
✗ Incorrect
The correct function to fetch all documents is
getDocs().What does
collection(db, 'users') do?✗ Incorrect
It creates a reference to the 'users' collection in Firestore.
After fetching documents, which method gets the data inside a document?
✗ Incorrect
Use
doc.data() to access the document's data.What type of object holds all documents fetched from a collection?
✗ Incorrect
A
QuerySnapshot contains all the documents fetched.Which method is commonly used to loop through all documents in a QuerySnapshot?
✗ Incorrect
Use
forEach() to loop through each document.Explain step-by-step how to get all documents from a Firestore collection.
Think about how you open a folder, look at each file, and read its content.
You got /5 concepts.
What is the difference between a CollectionReference and a QuerySnapshot in Firestore?
Imagine a folder and the list of files inside it.
You got /4 concepts.