LESSON 06 / 20·2 min readIntermediate

What index types should I know?

01 Understand02 Recall03 Prepare

Understand the concept

MongoDB offers different index types because equality lookup, array search, text search, uniqueness and expiry have different needs. A compound index orders several fields together, while a partial index includes only documents matching a condition. TTL indexes support eventual cleanup rather than precise scheduling.

Important ideas

  • Single-field: one field; compound: multiple fields; multikey: array values.

  • Unique: prevents duplicate indexed values; partial: indexes only matching documents.

  • Text: word search; TTL: expires documents asynchronously, not at an exact second.

  • A unique index has specific behavior for missing/null fields and arrays, so test it against the actual optional-field model.

PAUSE & RECALL

Can you explain it without the notes?

What index types should I know?

Use your own words. Explain an example and one limitation before checking the explanation.

Check your explanation

MongoDB offers different index types because equality lookup, array search, text search, uniqueness and expiry have different needs. A compound index orders several fields together, while a partial index includes only documents matching a condition. TTL indexes support eventual cleanup rather than precise scheduling.

CONNECT IT TO YOUR INTERVIEW

Turn this concept into a clear answer.

  • Choose an index from a query or data rule; do not add every index type just because it exists.
Practice this concept
YOUR NEXT STEP

Keep connecting the ideas.

Next lesson: What is the ESR rule?

Adapted from 04_MONGODB_MONGOOSE.md · “What index types should I know?”. Examples are study fragments; framework behavior can depend on your version.