Interview practice question
Mixed document versions in MongoDB
Backend Engineering · NoSQL and Redis · Experienced
After several releases, your MongoDB collection contains documents in four different shapes, causing bugs. How do you clean this up and prevent it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Add schemaVersion field.
- Read-time upgrade functions.
- Background migration to latest.
- JSON schema validation for new writes.
- Remove old-version code after migration.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.