Indexing is an inherent part of any database, so it is with MongoDB. Indexing data is necessary to help reduce the scan overhead when finding the values, for which there is a proverbial, “needle in a haystack.” In this chapter, I will discuss how indexing works, indexing policies, possibilities of customization, and indexing optimization.
Indexing in MongoDB
In MongoDB, users must define which path is to be indexed, and how. This decision defines the performance of the query. However, indexes have their own overhead. This creates a separate parallel tree structure that consumes RAM, storage, ...