0
0
Firebasecloud~10 mins

Setting with merge option in Firebase - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
Aoverwrite
Bmerge
Cupdate
Dreplace
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'overwrite' will replace the entire document.
Using 'update' is a different method, not an option here.
2fill in blank
medium

Complete 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'
Areplace
Boverwrite
Cmerge
Dupdate
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing 'update' method with 'merge' option.
Forgetting to pass the option as an object.
3fill in blank
hard

Fix 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'
Atrue
Bmerge: false
Cmerge
Dmerge: true
Attempts:
3 left
💡 Hint
Common Mistakes
Passing 'merge' without a value.
Passing 'true' without key.
4fill in blank
hard

Fill 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'
Amerge
Btrue
Cfalse
Doverwrite
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'false' disables merging and overwrites data.
Using 'overwrite' is not a valid option.
5fill in blank
hard

Fill 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'
A25
Bmerge
Ctrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'false' disables merging and overwrites data.
Passing merge option incorrectly as a string.