Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the number in quotes, making it a string.
Using the field name instead of the value.
✗ Incorrect
The value to update the field must be a number, not a string or a variable name.
2fill in blank
mediumComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around the string value.
Using the field name instead of the value.
✗ Incorrect
String values in JavaScript must be inside quotes.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name without defining it.
Not using quotes around the email string.
✗ Incorrect
The email value must be a string literal with quotes.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around the names.
Using unquoted variable names.
✗ Incorrect
Both names must be strings with quotes.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting zip code in quotes making it a string.
Not quoting city or state strings.
✗ Incorrect
City and state are strings with quotes; zip is a number without quotes.