Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set data in Firestore with merge option.
Firebase
db.collection('users').doc('user1').set({ name: 'Alice' }, { [1]: true });
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'overwrite' will replace the entire document.
Using 'update' is a different method, not an option here.
✗ Incorrect
The merge option allows you to update specific fields without overwriting the entire document.
2fill in blank
mediumComplete the code to merge new data into an existing Firestore document.
Firebase
db.collection('settings').doc('config').set({ theme: 'dark' }, { [1]: true });
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing 'update' method with 'merge' option.
Forgetting to pass the option as an object.
✗ Incorrect
Using merge: true updates only the specified fields.
3fill in blank
hardFix the error in the Firestore set call to merge data correctly.
Firebase
db.collection('profiles').doc('user2').set({ age: 30 }, { [1] });
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing 'merge' without a value.
Passing 'true' without key.
✗ Incorrect
The option must be an object with merge: true to merge fields.
4fill in blank
hardFill both blanks to set data with merge option and update the 'status' field.
Firebase
db.collection('orders').doc('order1').set({ status: 'shipped' }, { [1]: [2] });
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'false' disables merging and overwrites data.
Using 'overwrite' is not a valid option.
✗ Incorrect
Use merge: true to update only the 'status' field without overwriting the whole document.
5fill in blank
hardFill all three blanks to set nested data with merge option in Firestore.
Firebase
db.collection('users').doc('user3').set({ profile: { age: [1] } }, { [2]: [3] });
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'false' disables merging and overwrites data.
Passing merge option incorrectly as a string.
✗ Incorrect
Set the age to 25 and use merge: true to update nested fields without overwriting the whole document.