In this chapter, we will explore one of the most important properties of every database, indexing. Similar to book indexes, database indexes allow for quicker data retrieval. In the RDBMS world, indexes are widely used (and abused) to speed up data access.
In MongoDB, indexes play an integral part in schema and query design. MongoDB supports a wide array of indexes that we will learn about in this chapter:
- Single field
- Compound
- Multikey
- Geospatial
- Text
- Hashed
- Time to live
- Unique
- Partial
- Sparse
- Case-insensitive
In addition to learning about different types of index, we will show how to build and manage indexes for single-server deployments as well as complex sharded environments.
Finally, we will dive deeper into how MongoDB creates and organizes indexes with the goal of learning how to write more efficient indexes and evaluating the performance of our existing indexes...