Recall & Review
beginner
What does CRUD stand for in Firestore operations?
CRUD stands for Create, Read, Update, and Delete. These are the four basic operations to manage data in Firestore.
Click to reveal answer
beginner
How do you add a new document to a Firestore collection in React Native?
Use the
add() method on a collection reference. For example: firestore().collection('users').add({name: 'Anna'}) adds a new user document.Click to reveal answer
beginner
Which Firestore method is used to get a single document by its ID?
Use
doc(id).get() on a collection reference. For example: firestore().collection('users').doc('abc123').get() fetches the document with ID 'abc123'.Click to reveal answer
intermediate
How do you update fields in an existing Firestore document?
Use the
update() method on a document reference. For example: firestore().collection('users').doc('abc123').update({age: 30}) updates the age field.Click to reveal answer
intermediate
What happens if you use
set() with {merge: true} in Firestore?It updates the document by merging new fields with existing ones without overwriting the whole document.
Click to reveal answer
Which Firestore method adds a new document with an auto-generated ID?
✗ Incorrect
The add() method adds a new document with a unique ID automatically generated by Firestore.
How do you delete a document in Firestore using React Native?
✗ Incorrect
Use doc(id).delete() to remove a specific document by its ID.
What does
get() return when called on a document reference?✗ Incorrect
get() returns a promise that resolves to a document snapshot, which contains the data and metadata.
Which method overwrites the entire document in Firestore?
✗ Incorrect
set() without {merge: true} replaces the whole document content.
To read all documents in a collection, which method is used?
✗ Incorrect
collection().get() fetches all documents in that collection.
Explain how to perform each CRUD operation in Firestore using React Native.
Think about the Firestore methods for collections and documents.
You got /4 concepts.
Describe the difference between
set() with and without the merge option in Firestore.Consider what happens to existing data in the document.
You got /3 concepts.