0
0
Firebasecloud~10 mins

Updating specific fields 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 update a single field in a Firestore document.

Firebase
db.collection('users').doc('user123').update({ 'age': [1] });
Drag options to blanks, or click blank then click option'
A30
B'30'
Cage
Dupdate
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the number in quotes, making it a string.
Using the field name instead of the value.
2fill in blank
medium

Complete the code to update the 'status' field to 'active' in a Firestore document.

Firebase
db.collection('tasks').doc('task1').update({ 'status': [1] });
Drag options to blanks, or click blank then click option'
Aactive
B'active'
C"active"
Dstatus
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around the string value.
Using the field name instead of the value.
3fill in blank
hard

Fix the error in the code to update the 'email' field in Firestore.

Firebase
db.collection('users').doc('user456').update({ email: [1] });
Drag options to blanks, or click blank then click option'
Auser.email
B"user@example.com"
CuserEmail
D'user@example.com'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name without defining it.
Not using quotes around the email string.
4fill in blank
hard

Fill both blanks to update 'firstName' and 'lastName' fields in Firestore.

Firebase
db.collection('users').doc('user789').update({ 'firstName': [1], 'lastName': [2] });
Drag options to blanks, or click blank then click option'
A'John'
B'Doe'
CJohn
DDoe
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around the names.
Using unquoted variable names.
5fill in blank
hard

Fill all three blanks to update 'city', 'state', and 'zip' fields in Firestore.

Firebase
db.collection('addresses').doc('addr1').update({ 'city': [1], 'state': [2], 'zip': [3] });
Drag options to blanks, or click blank then click option'
A'Seattle'
B'WA'
C98101
D9810
Attempts:
3 left
💡 Hint
Common Mistakes
Putting zip code in quotes making it a string.
Not quoting city or state strings.