How would you structure your Cloud Firestore db.
I have collections of Teams, Arenas and Games:
public class Team {
public String name;
public String homeCourtId;
}
public class Game{
public String matchId;
public String date;
public Arena arena;
public Team homeTeam;
public Team awayTeam;
}
public class Arena {
public String name;
public String phone;
public String email;
public String address;
public String postalCode;
public String city;
public String district;
public String cordLat;
public String cordLong;
}
A team can be a home team or away team in Games and a Game always has an Arena.
So currently my thought is to structure this as all games go into the Games collection and when i want to find out all games for a Team i need to query the Games collection and find all games where selected team is either home team or away team.
Should I have references to the teams by there Firestore generated id or should I go for team names? Any pointers where i can read more about this?
Is their a better way to structure my data in Firestore? (or any nosql db)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…