I am trying to append data to my database, everytime a user is clicking a like button, if the user hasn't already clicked it. The problem is, when I am appending to the likesForPost
, a unique id is showing. How can I get rid of that? Otherwise it is not possible for me to check if the user has already clicked the button?
Here is my firebase structure:
It is the green parts that are unique id, the black zones under the unique id are the user id, that I want to be able to check if has already clicked the button.
This is my code for appending to likesForPost
let quoteString = [userId: true]
let refPhotos = FIRDatabase.database().reference().child("feed-items").child(dataPathen).child("likesForPost")
let refBase54 = refPhotos.childByAutoId()
refBase54.setValue(quoteString)
Hope you guys can help me :-)