Interview practice question
Slow MongoDB queries
Backend Engineering · NoSQL and Redis · Beginner
Queries filtering orders by customerId and status in MongoDB are slow. How do you fix them?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Check explain() for COLLSCAN.
- Create compound index {customerId: 1, status: 1}.
- Order fields by query pattern (ESR rule).
- Include sort fields.
- Monitor slow query log.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.