MongoDB is easy to start with and easy to model badly. These questions check whether a candidate designs for access patterns or just dumps JSON.
Hiring a MongoDB developer is easy. Telling a real one from a convincing résumé is the hard part — and it’s most of what we do. These are grouped by level, because the same question that stretches a junior is a warm-up for a senior.
Junior MongoDB interview questions
0–2 years
Documents and queries.
What is a document database?
Stores flexible, schema-less JSON-like documents (BSON) grouped in collections, rather than rows in tables.
Models data exactly like relational tables.
What is the difference between a document and a collection?
A document is a single record; a collection is a group of documents, loosely analogous to a table.
Confuses the two.
How do you query documents?
find with query filters and projections; operators like $gt, $in refine matches.
Fetches whole documents and filters in app code.
What is the _id field?
A unique primary key per document, an ObjectId by default, indexed automatically.
Adds a redundant custom id and ignores _id.
What is the difference between embedding and referencing?
Embedding nests related data in one document; referencing links documents by id. Choose by access pattern and growth.
Always normalises with references like SQL.
How do inserts and updates work?
insertOne/insertMany and update operators like $set, $inc, with upsert options.
Replaces whole documents to change one field.
What is BSON?
A binary-encoded superset of JSON with extra types (dates, ObjectId, binary) that Mongo stores.
Thinks documents are plain JSON strings.
How does Mongo handle schema flexibility?
Documents in a collection can differ, which is flexible but requires discipline and validation to avoid chaos.
Lets each document have arbitrary, inconsistent shapes.
Mid-level MongoDB interview questions
2–5 years
Indexing and aggregation.
How does indexing work in MongoDB?
Indexes (single, compound, multikey, text) speed queries; the leftmost-prefix rule applies to compound indexes.
Queries huge collections with no indexes.
What is the aggregation pipeline?
A staged framework ($match, $group, $lookup, etc.) transforming documents for analytics-style queries.
Pulls all data into the app and aggregates there.
What is $lookup and its cost?
A join across collections in the pipeline; useful but can be expensive, which is why data is often embedded instead.
Uses $lookup everywhere as if joins were free.
How do you design a schema in MongoDB?
Around read/write access patterns, embedding for data read together and referencing for large or independently-changing data.
Copies a relational schema directly.
What are the tradeoffs of embedding vs referencing at scale?
Embedding is fast to read but risks unbounded document growth; referencing avoids that but needs extra lookups.
Embeds an unbounded array that eventually exceeds document limits.
How do write concerns and read preferences work?
Write concern controls acknowledgement/durability; read preference chooses primary vs secondaries, trading consistency for scale.
Reads from secondaries and is surprised by stale data.
How does Mongo handle transactions?
Multi-document ACID transactions exist but add cost; design often avoids needing them via good document modelling.
Assumes Mongo can’t do transactions, or overuses them.
What causes slow queries and how do you find them?
Missing indexes and collection scans; explain() and the profiler surface them.
Never runs explain().
Senior MongoDB interview questions
5+ years
Scaling and operations.
How does sharding work and how do you pick a shard key?
Data is distributed across shards by a key; a good key spreads load evenly and matches queries, avoiding hotspots.
Picks a monotonically increasing shard key, creating a hotspot.
How do replica sets provide availability?
A primary with secondaries replicating data; automatic failover promotes a secondary if the primary fails.
Runs a single node in production.
When is MongoDB the right or wrong choice?
Right for flexible, document-shaped, high-write workloads; wrong when you need complex multi-entity transactions and rich relational queries.
Claims it replaces a relational database in all cases.
How do you prevent unbounded document growth?
Cap arrays, use the bucket pattern or references for ever-growing data, and watch the document size limit.
Appends forever to an embedded array.
How do you model many-to-many relationships?
References with arrays of ids or a linking pattern, chosen by cardinality and query needs.
Duplicates data and lets it drift out of sync.
How do you keep queries fast at scale?
Cover queries with compound indexes, avoid collection scans, project only needed fields, and watch working-set memory.
Lets the working set exceed RAM with no plan.
How do you handle schema evolution without downtime?
Tolerant readers, versioned document shapes, and lazy or background migration of documents.
Runs a blocking migration over the whole collection.
What consistency guarantees does MongoDB provide?
Tunable via write/read concerns; you can get strong consistency on the primary or eventual reads from secondaries.
Assumes every read is always up to date.
Build and score a full interview with our free interview scorecard tool, browse the full question hub, or see how we interview engineers.