You have a Firestore document with fields name, age, and city. You run an update to delete the age field. What is the state of the document after this operation?
const docRef = firestore.collection('users').doc('user1'); docRef.update({ age: firebase.firestore.FieldValue.delete() });
Think about what FieldValue.delete() does in Firestore updates.
Using FieldValue.delete() in an update removes that field from the document without affecting other fields.
You want to delete the nested field address.zipcode from a Firestore document. Which update command will do this correctly?
Consider how Firestore handles dot notation for nested fields in updates.
Using dot notation with FieldValue.delete() deletes only the nested field without affecting other nested fields.
You delete a frequently queried field from many documents in a Firestore collection. What is the impact on Firestore indexes and query performance?
Think about how Firestore maintains indexes when documents change.
Firestore automatically updates indexes when fields are deleted, removing those entries to keep queries accurate and efficient.
You have a Firestore security rule that allows users to update their documents but denies deleting any fields. What happens if a user tries to delete a field using FieldValue.delete()?
Consider how Firestore security rules control update operations.
Firestore security rules enforce permissions on all update operations, including field deletions. If deletion is denied, the update is rejected.
You need to delete multiple fields from a Firestore document in a single operation to keep data consistent. Which approach is best?
Think about atomicity and minimizing network calls.
Using a single update() with multiple FieldValue.delete() calls deletes all fields atomically and efficiently.