Topics such as replication and sharding are beyond the scope of this book. However, there are a number of things developers can do to optimize the performance of your MongoDB database.
Mainly, we'll talk about cover indexing and tuning queries for performance.
In many database systems, adding an
index in a field when appropriate can speed up querying. Queries are optimized when performed on indexed fields. MongoDB is no different.
The downside to indexes is that they add some extra time to write operations. They also take up extra space in the database. It makes sense to index wisely. When considering adding indexes, you want to think about whether you expect more read than write operations. This would be a plus ...