Recall & Review
beginner
What is a collection scan in MongoDB?
A collection scan is when MongoDB reads every document in a collection to find those that match a query. It checks documents one by one without using an index.
Click to reveal answer
beginner
How does MongoDB use indexes to scan documents?
MongoDB uses indexes to quickly find documents matching a query without scanning the whole collection. It looks up index entries to locate documents efficiently.
Click to reveal answer
intermediate
What is the difference between a collection scan and an index scan?
A collection scan reads every document in the collection, while an index scan uses an index to find matching documents faster, scanning fewer documents.
Click to reveal answer
beginner
Why can collection scans be slow in MongoDB?
Collection scans can be slow because MongoDB must check every document in the collection, which takes more time as the collection grows larger.
Click to reveal answer
intermediate
How can you check if MongoDB is using a collection scan or an index scan?
You can use the explain() method on a query. It shows whether MongoDB used a collection scan or an index scan to find documents.
Click to reveal answer
What does MongoDB do during a collection scan?
✗ Incorrect
A collection scan means MongoDB reads every document to find matches.
Which method helps you see if MongoDB used an index or collection scan?
✗ Incorrect
The explain() method shows the query plan including scan type.
Why are index scans faster than collection scans?
✗ Incorrect
Index scans use indexes to read fewer documents, speeding up queries.
What happens if no index matches a query in MongoDB?
✗ Incorrect
Without a matching index, MongoDB scans all documents to find matches.
Which of these is a sign of a slow query in MongoDB?
✗ Incorrect
Collection scans can slow queries because they read every document.
Explain how MongoDB scans documents when answering a query.
Think about how MongoDB finds matching documents with and without indexes.
You got /3 concepts.
Describe why using indexes is important for MongoDB query performance.
Consider what happens when MongoDB has to check every document.
You got /3 concepts.