Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
855 views
in Technique[技术] by (71.8m points)

java - Nosql model structure

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...