Need Assistance?

support@tutorialshub.in

Indexes & Query Performance

How Indexes Work in MongoDB

ADVERTISEMENT
MongoDB Free Lesson
5 min read
ADVERTISEMENT

Without an index, MongoDB must perform a Collection Scan (COLLSCAN)—checking every single document in the collection. An Index (a B-tree data structure) lets MongoDB jump directly to matching documents (IXSCAN) in milliseconds.

Trade-off: Indexes dramatically speed up reads, but slightly slow down writes and consume RAM.

ADVERTISEMENT
Hi, I'm Tuby! Here to help you