如何在RavenDB中对足球比赛统计数据建模 [英] How to model football game statistics in RavenDB

查看:119
本文介绍了如何在RavenDB中对足球比赛统计数据建模的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是RavenDB的新手,我仍在努力寻找为当前方案建模数据的最佳方法。数据如下所示。

I'm new to RavenDB and I'm still trying to get my head around the best way to model the data for the current scenario. Here is what the data looks like.

Game 
 - Teams
   - Team 1
     - list of players
   - Team 2 
     - list of players
 - Events
   - Event 1
     - type: Pass
     - teamId
     - PlayerId
   - Event 2
     - type: Goal
     - teamId
     - PlayerId

在每个游戏开始时,我们都会获得游戏的整体信息(例如,团队,场地等),然后每隔几分钟,我们就会获得更新的事件列表。
另外,我还需要能够考虑到游戏中特定玩家的数据(例如,玩家拥有多少通行证)

At the beginning of each game we get the overall info for the game (e.g. Teams, Venue etc) and then every few minutes we get an updated list of events. Also I need to be able to query data for a particular player thoughtout the game (e.g. How many passes a player has)

我是否将其存储为单一文件?我是否将事件拆分为单独的文档,例如GameEvents?还有第三种情况吗?

Do I store it as a single document? Do I split the Events into a separate document e.g. GameEvents? Is there a third scenario?

推荐答案

将其存储为单个对象-您定义的结构很棒。然后,只需为要执行的各种查询定义索引。不必将事情分解成具有关联关系的表,这就是使Raven这样的文档数据库很棒的原因-非常适合您所描述的场景。

Store it as a single object - the structure you've defined is great. Then just define indexes for the various types of queries you will be doing. Not having to break things down into tables with relationships is what makes document DBs like Raven awesome - great for scenarios just like what you are describing.

这篇关于如何在RavenDB中对足球比赛统计数据建模的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆