'How to delete a specific array element in firebase collection?

I have list of appointments stored in firebase collection, how can I delete a specific appointment ?

enter image description here



Solution 1:[1]

If you know the exact value for each field of the array item, you can use FieldValue.remove to remove that item from the array.

If you don't know all values of the item, the only way to remove the item is to:

  1. Load the document into your application code.
  2. Get the entire array from the document.
  3. Remove the item from the array.
  4. Write the entire array back to the document in the database.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Frank van Puffelen