How to delete a specific array element in firebase collection?

273

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.
Share:
273
Faris Shomali
Author by

Faris Shomali

Updated on January 04, 2023

Comments

  • Faris Shomali
    Faris Shomali over 1 year

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

    enter image description here