intermediate
MongoDB
Use document modeling, collections, indexes, aggregation, schema design, and transactions around access patterns and consistency needs.
MongoDB interviews test document modeling for access patterns: embedding versus referencing, index design for compound queries, aggregation pipelines, and when multi-document transactions are worth the cost.
Subtopics: documents, collections, indexes, aggregation pipeline, schema design, transactions.
On interviews: sketch a document shape for a read-heavy feature, name indexes for the pipeline, and explain growth and write contention risks.
Common pitfalls: relational modeling with extra joins in app code; unbounded document growth; transactions as default instead of document boundaries.
The trade-off is balancing schema flexibility against index discipline and operational complexity at scale.
Checklist:
- Model around read locality and update boundaries.
- Index real query and sort shapes.
- Use aggregation for server-side reshape, not app fan-out.
- Reserve transactions for cross-document invariants only.