4

I have a list of comment objects inside of an object. If I want to add a comment without touching the other comments how would I do that? I have used transactions in the past for editing an integer efficiently but I don't know if I can do that with a list. The end goal is for multiple users to be a ble to add comments at the same time without cutting eachother off (overriding their edits).

Here is an example of my database: enter image description here

1

1 Answer 1

3

Solved it! Super simple. Just had to add push() to the end of my DatabaseRefercence like so. It gives every comment a key.

commentRef = pollRef.child("comments").push();
commentRef.setValue(comment);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.