Recall & Review
beginner
What is an index in MongoDB?
An index in MongoDB is a special data structure that stores a small portion of the data set in an easy-to-search form. It helps MongoDB find data quickly without scanning every document.
Click to reveal answer
beginner
How do indexes improve query performance?
Indexes let MongoDB quickly locate the data by using the index keys instead of scanning all documents. This reduces the time and resources needed to find matching documents.Click to reveal answer
beginner
What happens if a query has no index to use?
MongoDB must perform a collection scan, checking every document one by one. This is slow and uses more CPU and memory, especially for large collections.
Click to reveal answer
intermediate
Can indexes slow down write operations?
Yes, because MongoDB must update indexes every time data changes. But the speed gained in reading data usually outweighs this cost.
Click to reveal answer
intermediate
Why is choosing the right fields for indexes important?
Indexes use storage and affect write speed. Choosing fields that are often searched or sorted helps queries run fast without wasting resources on unused indexes.
Click to reveal answer
What does an index in MongoDB help with?
✗ Incorrect
Indexes help MongoDB find data quickly by avoiding scanning every document.
What is a collection scan?
✗ Incorrect
A collection scan means MongoDB checks every document because no suitable index exists.
How do indexes affect write operations?
✗ Incorrect
Indexes slow down writes because MongoDB updates the index data when documents change.
Why should you choose fields carefully for indexing?
✗ Incorrect
Choosing the right fields for indexes saves space and makes queries faster.
Which of these is NOT a benefit of indexes?
✗ Incorrect
Indexes do not make writes instant; they can slow down writes due to updates.
Explain why indexes are important for MongoDB query performance.
Think about how searching a phone book is faster than reading every page.
You got /4 concepts.
Describe the trade-offs of using indexes in MongoDB.
Consider both benefits and costs of indexes.
You got /4 concepts.