B. doc() cannot be used to get a document reference.
C. deleteDoc must be called without await.
D. deleteDoc should receive a document reference, not a collection.
Solution
Step 1: Check deleteDoc argument type
The deleteDoc function requires a document reference, not a collection reference.
Step 2: Analyze the code's argument
The code passes collection(db, 'notes', 'note1') which is invalid because collection() does not accept a document ID.
Final Answer:
deleteDoc should receive a document reference, not a collection. -> Option D
Quick Check:
deleteDoc(docRef) not deleteDoc(collection(...)) [OK]
Hint: deleteDoc needs doc(), not collection() [OK]
Common Mistakes:
Passing collection() instead of doc() to deleteDoc
Misunderstanding collection() parameters
Omitting await on async calls
5. You want to update a user's profile in Firestore only if the 'age' field exists and is less than 30. Which code snippet correctly performs this conditional update?