The good news is that MongoDB has come up with a clever solution to scale your database system easily. Sharding is a technique used to scale a database horizontally.
Using sharding, the entire database is divided into separate single databases on different machines. Finally, using a query router, all the separate nodes make a single logical database.
Let's look at an example of sharding. Suppose we have a database sized 1 TB. Storing such a large dataset on a single server is a big challenge, so we use sharding to divide the entire database into smaller instances called shards.
In order to reduce the size of the entire database, we divide it into databases sized 256 GB. During the sharding procedure, each part of the database ...