You are previewing MongoDB in Action.

MongoDB in Action

Cover of MongoDB in Action by Kyle Banker Published by Manning Publications

Chapter 7. Indexing and query optimization


In this chapter
  • Basic indexing concepts and theory
  • Managing indexes
  • Optimizing queries


Indexes are enormously important. With the right indexes in place, MongoDB can use its hardware efficiently and serve your application’s queries quickly. But having the wrong indexes produces the opposite result: slow queries and poorly utilized hardware. It stands to reason that anyone wanting to use MongoDB effectively must understand indexing.

But for many developers, indexes are a topic shrouded in mystery. This need not be the case. Once you’ve finished this chapter, you should have a good mental model for thinking clearly about indexes. To introduce the concepts of indexing, we’ll begin with a modest ...

The best content for your career. Discover unlimited learning on demand for around $1/day.