Data indexing and sharding in MongoDB
In this recipe, we will manage football matches and their timeline – that is, the events that occur during the game. An event may involve one or two players and we must consider that the players’ fans want to access all actions where their favorite players are involved. We will also consider that the number of matches and their events is growing every day, so we need to prepare our application to support all the load.
In this recipe, we’ll introduce some key concepts to make your application performant and scalable. MongoDB, like relational databases, enables you to create indexes that optimize data access. If you plan to access certain data using the same parameters, it is worth creating indexes to optimize data read. Of course, you will require more storage and memory, and write operations will be impacted. So, you will need to plan and analyze your application needs.
As the size of your data increases, you will need...