data modeling - Modelling tournament brackets in MongoDB -
I'm experimenting with MongoDB to move some parts of an app to it. I am thinking of a document-based DB like the Mongoode tournament will be a good fit for the bracket, but I have a tough time coming up with a suitable model. (Still trying to get rid of RDBMS dogma)
Have any ideas for a single and double-elimination tournament bracket model?
Both tournament variation originally comes in each match, or one of these options is either:
- The player wins and advances for the next round
- The player wins and wins the tournament
- The player loses and exits the tournament
- The player loses and advances for a loser bracket
, if you make it a model Shall have a collection of games, including schema:
{_id: .., & lt; - Match ID Player: [playerId1, playerId2], as a result of: & lt; Either "WINS_TOURNAMENT" or the match match for the next match & gt; As a result, the locker: & lt; Either "EXIT_TOURNAMENT" or the matching idle of bracket matching ID}
You can write both tournaments brackets with this schema and reuse your tournament logic without distinguishing between two Other than the bracket setup.
Comments
Post a Comment