0
0
React Nativemobile~5 mins

Firestore CRUD operations in React Native - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Aadd()
Bset()
Cupdate()
Dget()
How do you delete a document in Firestore using React Native?
Acollection().delete()
Bupdate({deleted: true})
Cdoc(id).remove()
Ddoc(id).delete()
What does get() return when called on a document reference?
AAn array of documents
BA promise resolving to the document snapshot
CThe document data directly
DNothing
Which method overwrites the entire document in Firestore?
Aupdate()
Bget()
Cset() without merge option
Dadd()
To read all documents in a collection, which method is used?
Acollection().get()
Bdoc().get()
Cadd()
Dupdate()
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.