You are designing a chat room application that will host multiple rooms and retain the message history for each room. You have selected Firestore as your database. How should you represent the data in Firestore?
A.
Create a collection for the rooms. For each room, create a document that lists the contents of the messages
B.
Create a collection for the rooms. For each room, create a collection that contains a document for each message
C.
Create a collection for the rooms. For each room, create a document that contains a collection for documents, each of which contains a message.
D.
Create a collection for the rooms, and create a document for each room. Create a separate collection for messages, with one document per message. Each room’s document contains a list of references to the messages.
Answer is C. "The best way to store messages in this scenario is by using subcollections. A subcollection is a collection associated with a specific document."
https://firebase.google.com/docs/firestore/data-model#subcollections
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
__rajan__
7 months, 1 week agoTNT87
1 year, 4 months agozellck
1 year, 4 months agogardislan18
1 year, 5 months ago