Bellow is the overview of the table structure i have
Table data
----------------------------------
- User -
----------------------------------
| objectId | name | password |
----------------------------------
| z12ttttt | Matt | hidden |
| z12zzzzz | Jobs | hidden |
| z12bbbbb | Ballu | hidden |
| z12aaaaa | Stephin | hidden |
----------------------------------
--------------------------------------------------
- Post -
--------------------------------------------------
| objectId | post | postBy | likesCounter |
--------------------------------------------------
| blabla | Head Pain | z12ttttt | 0 |
| blab12 | Back Pain | z12ttttt | 0 |
| blab23 | Sleepy | z12ttttt | 0 |
| blab90 | Head Pain | z12zzzzz | 0 |
| blab90 | lets Dance| z12bbbbb | 0 |
| blab90 | lets jump | z12aaaaa | 0 |
--------------------------------------------------
//postBy has a 1 to 1 relationship with User table
Aim : All the users can view each others posts. Now when ever a user likes someones post, that post's likeCounter should increase by 1.
Problem : I cannot find a persistent way to update the likeCounter. The only way which is working is to
1) Retrieve Post
2) Do likeCount++
3) Save Post
As you can see there is a data persistency issue. Please help it will be better if you could show me a workable code. Although i have found This like but i cant figure out how to implement it