Skip to main content

MongoDB Indexing

mongodb.com/docs/manual/indexes/

MongoDB indexes use a B-tree data structure.

Indexes gets have better read time but have an impact on write time.

Index Types:

  • Single Field
  • Compound Index
  • Multikey Index
  • Geospatial Index
  • Text Indexes
  • Hashed Indexes

Index Properties:

  • Unique Indexes
  • Partial Indexes
  • Sparse Indexes
  • TTL Indexes (Time To Live)

See also:

Query plan

mongodb.com/docs/manual/core/query-plans

Query optimization

mongodb.com/docs/manual/core/query-optimization