Recall & Review
beginner
What does the 'merge' option do when setting data in Firebase Firestore?
The 'merge' option updates only the specified fields in a document without deleting other existing fields. It merges new data with existing data.
Click to reveal answer
beginner
How do you use the 'merge' option in Firestore's set() method?
You pass an object with { merge: true } as the second argument to the set() method, like: set(data, { merge: true }).
Click to reveal answer
beginner
What happens if you set data without the merge option in Firestore?
The entire document is overwritten, and any fields not included in the new data are deleted.
Click to reveal answer
beginner
Why is using the merge option useful in real-life applications?
It lets you update only parts of a document, like changing a user's email without losing their profile info, similar to editing one part of a form without erasing the rest.
Click to reveal answer
beginner
Can the merge option be used to add new fields to an existing Firestore document?
Yes, merge allows adding new fields while keeping existing fields intact.
Click to reveal answer
What does setting { merge: true } do in Firestore's set() method?
✗ Incorrect
The merge option updates only the fields you specify, keeping other fields unchanged.
If you call set() without merge on an existing document, what happens?
✗ Incorrect
Without merge, set() replaces the entire document with new data.
Which of these is a benefit of using merge when updating Firestore documents?
✗ Incorrect
Merge combines new data with existing fields without deleting them.
How do you pass the merge option in Firestore's set() method?
✗ Incorrect
The merge option is passed as an object: { merge: true }.
Can merge option add new fields to an existing document?
✗ Incorrect
Merge allows adding new fields while keeping existing fields intact.
Explain how the merge option affects updating a Firestore document.
Think about how you can change part of a document without losing the rest.
You got /4 concepts.
Describe a real-life scenario where using the merge option is helpful.
Imagine changing your email address but keeping your name and photo unchanged.
You got /4 concepts.