I am actually new in programming and in Firebase. I need to know which one is better between these 2 scenarios.
I am making an event app. and if a user will attend the event, I write a document in the subcollection "attendedEvents" that nested in "users" collection like this:
and then, I need to manage and to display the full data of that attended event to client app, i need to display the data like location, coordinate, venue etc etc.
there are two ways to save the attended events data
1. I just write eventID in the "attendedEvents" subcollection. like this
and then when i need to display the full data, i need to do 2 steps. first I get all the eventID in that "attendedEvents" subcollection, and then do a query specifically based on eventID to get the full event data.
2. I write all the events data in the the "attendedEvents" subcollection fields, not just eventID. like this
so when i need to display the event data in the client app, I just need to do one query only to reference "attendedEvents" subcollection.
what is the advantage and the disadvantage between these two?
to be honest I am not really sure to choose. but at the moment I will choose just to write the eventID, since there is storage pricing in firebase, even though the data real time synchronization is not really needed when i display that attended event data to client app.
and how about Network bandwidth ? since You are charged for the network bandwidth used by your Cloud Firestore requests since the first choice takes more bandwidth right? I am not really grasp about this network bandwidth