Interview practice question
MongoDB document keeps growing
Backend Engineering · NoSQL and Redis · Intermediate
You store all of a user's activity events in an array inside their MongoDB document, and some documents are approaching 16 MB. What do you do?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Unbounded arrays are an anti-pattern.
- Move events to separate collection.
- Index by userId + time.
- Or bucket pattern (per day/month docs).
- Keep summary/recent N in user doc.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.