-2

I want to delete the first element of Array.

enter image description here

Kevin M. Mansour
  • 2,915
  • 6
  • 18
  • 35

2 Answers2

0

You can by just updating the whole array :

yourArray.removeAt(0); //yourArray is the array in the firestore before changing anything
doc("docId").update("Array" : yourArray);
Khalil Ktiri
  • 181
  • 1
  • 6
0

To remove an array inside Firebase Firestore. Try the following function:

docRef.update({
   array: FieldValue.arrayRemove(''); // Here add your Element ID which you want to remove it.
});

Notice : This method only works with simple array like ["test","test"] not array with objects.

Thanks for @Evin1_ in (https://stackoverflow.com/a/59745086/14945696).

Kevin M. Mansour
  • 2,915
  • 6
  • 18
  • 35