tags containing ["cloud", "storage"]. You run an update with arrayUnion("storage", "database"). What will be the new value of tags?The arrayUnion operation adds elements to the array only if they do not already exist. Since "storage" is already present, it is not duplicated. "database" is added.
features with value ["auth", "hosting"]. You run an update with arrayRemove("functions"). What will be the value of features after the update?If the element to remove does not exist in the array, the array remains unchanged.
permissions array to add "read" and "write" without duplicates. Which update code snippet is correct?arrayUnion takes multiple elements as separate arguments to add them uniquely. Passing an array as a single argument adds the array as one element, not its contents.
arrayUnion to add user-provided tags to a Firestore array field without validation, what risk might occur?Using arrayUnion with unchecked user input can allow users to add unwanted or harmful data to your database, which can affect data quality and security.
activeUsers updated with unique user IDs as users become active or inactive. Which approach best ensures uniqueness and efficient updates?Using arrayUnion and arrayRemove ensures that user IDs are added or removed uniquely without duplicates or overwriting the entire array, making updates efficient and safe.
