I want to delete the first element of Array.
Asked
Active
Viewed 136 times
-2
-
1Can you be more specific? – Yatinj Sutariya May 01 '21 at 13:21
-
Did my answer help you? – Kevin M. Mansour May 04 '21 at 19:43
2 Answers
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
- 133
- 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
- 1,932
- 5
- 14
- 28