'Firestore data modeling
I am creating a new Firestore database and am new to NoSQL. I am creating an application where I would need 4 root collections. Users, teams, challenges, and tournaments. Users need to join teams. Admins need to create challenges and tournaments. Tournaments need challenges and participants. I was wondering how this could be modeled the best in Firestore. This is what it looks like in JSON format so far:
{
"users": {
"uid": "user_id",
"firstName": "John",
"lastName": "Doe"
},
"teams": {
"members": {
"user_id": {
"uid": "user_id",
"firstName": "John",
"lastName": "Doe"
}
},
"teamName": "Team X",
"teamPhoto": "url"
},
"challenges": {
"doc1": {
"challengeName": "name",
"challengeDescription": "description"
}
},
"tournaments": {
"selectedChallenges": [
{
"challenge_doc1": {
"challengeName": "name",
"challengeDescription": "description"
}
}
],
"tournamentName": "name"
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
