I'm trying to update the likes on a post from the app when a button is pressed. The posts are located in an array and I'm trying to update the int of the likes of the post.
Asked
Active
Viewed 81 times
0
-
There is no way to update an item in an array by an index. You'll have to read the document, get the current value for the `posts` array, update that, and write the entire (updated) array back to the database. – Frank van Puffelen Oct 04 '22 at 00:05
-
so how do i read the likes number and update it? – Oct 04 '22 at 00:11
-
Exactly as I said: read the document, get the array from it, update the value, and write the entire array back to the document. – Frank van Puffelen Oct 04 '22 at 00:49