01 / 18

What are indexes?

In MongoDB, indexes are data structures that store a small portion of the collection's data, enabling efficient query execution by allowing MongoDB to quickly locate documents without scanning the entire collection.

  1. 1

    Indexes support efficient execution of queries in MongoDB.

  2. 2

    Without indexes, MongoDB must scan every document in a collection to return query results.

  3. 3

    MongoDB uses the index to limit the number of documents it must scan.