MERN Stack Interview Questions (With Answers) for 2026
25+ MERN stack interview questions and answers - covering MongoDB, Express, React, and Node.js. Whether you're a MERN stack developer prepping for interviews or brushing up on MERN fundamentals, this covers the full stack, not just React.
Most MERN interview prep out there is really just React prep with a MongoDB question bolted on at the end. That's a problem, because a real MERN interview loop tests all four layers — MongoDB, Express, React, and Node — and it's common to get tripped up on the parts you didn't expect, not the parts you studied hardest. Whether you call it MERN stack interview questions, MERN interview questions, or you're specifically prepping as a MERN stack developer for a full-stack role, this list is organized so you can spot exactly where your gaps are.
This is a straight list, organized by layer, so you can see exactly where your gaps are before an interviewer finds them for you.
MongoDB interview questions
What's the difference between MongoDB and a relational database?
MongoDB stores data as flexible, JSON-like documents instead of rows in fixed-schema tables. Related data is often embedded directly in a document instead of joined across tables, which trades some normalization for faster reads on the access patterns you designed for.
When should you embed data versus reference it with an ObjectId?
Embed when the child data is only ever read alongside the parent and doesn't grow unbounded — like an address inside a user document. Reference when the data is large, shared across multiple parents, or updated independently — like orders belonging to a user.
What does an index actually do in MongoDB?
Without an index, a query scans every document in a collection. An index maintains a sorted data structure on a field, so MongoDB can jump straight to matching documents instead of scanning linearly. The tradeoff is slightly slower writes and extra storage.
// Create an index on the "email" field
db.users.createIndex({ email: 1 });
// This query now uses the index instead of a full collection scan
db.users.find({ email: "test@example.com" });What is the aggregation pipeline?
It's a sequence of stages — like $match, $group, and $sort — that documents pass through in order, each stage transforming the output of the one before it. It's how you do the equivalent of SQL's GROUP BY and JOIN-style operations in MongoDB.
What happens if you don't specify a schema in MongoDB?
MongoDB itself doesn't enforce a schema by default — any document shape is allowed in a collection. In practice, most teams use a library like Mongoose to define and enforce a schema at the application level, since an unenforced schema quickly leads to inconsistent data.
What's the difference between findOneAndUpdate and updateOne?
Both update a single matching document. updateOne returns a result object describing what changed. findOneAndUpdate returns the actual document — either the version before or after the update, depending on an option — which is useful when you need the updated data immediately without a second query.
Express.js interview questions
What is middleware in Express, really?
A middleware function is anything with the signature (req, res, next) that runs during the request/response cycle. It can inspect or modify the request, end the cycle by sending a response, or call next() to pass control to the next handler in line.
function logger(req, res, next) {
console.log(`${req.method} ${req.url}`);
next(); // hand off to the next middleware or route handler
}
app.use(logger);How does Express handle errors?
Express recognizes an error-handling middleware by its four arguments — (err, req, res, next). Any error passed to next(err) skips remaining regular middleware and jumps straight to the nearest error handler. Forgetting to define one means Express falls back to its default handler, which leaks a stack trace in development.
What's the difference between app.use() and app.get()?
app.use() mounts middleware for all HTTP methods on a path (or all paths). app.get() registers a handler for GET requests specifically. Route-specific methods like get/post/put/delete only fire for that exact verb.
How do you structure routes in a larger Express app?
Split routes into separate router modules using express.Router(), grouped by resource (userRoutes, orderRoutes), then mount each on a base path in the main app file. This keeps route logic out of one giant server file as the app grows.
What's the purpose of CORS middleware?
Browsers block cross-origin requests by default. CORS middleware adds the response headers (like Access-Control-Allow-Origin) that tell the browser a request from a different origin — say, your React dev server on a different port — is allowed to read the response.
How would you handle rate limiting in an Express API?
Typically with middleware like express-rate-limit, applied either globally or on specific routes, that tracks request counts per IP (or per user/token) within a time window and returns a 429 status once the limit is exceeded.
Node.js interview questions
Is Node.js single-threaded?
Your JavaScript code runs on a single thread, but Node itself uses a thread pool (via libuv) under the hood for things like file I/O and some crypto operations. The single thread you write code on is never blocked waiting on those — it's notified through the event loop once the work finishes.
What is the event loop, in plain terms?
It's the mechanism that lets Node handle many concurrent operations without multiple threads. Node kicks off an async operation, keeps executing other code, and the event loop checks a queue for completed callbacks — running them in phases (timers, I/O callbacks, close callbacks, etc.) once the current call stack is empty.
What's the difference between process.nextTick() and setImmediate()?
process.nextTick() queues a callback to run immediately after the current operation completes, before the event loop continues to the next phase. setImmediate() queues a callback to run in the check phase of the next event loop iteration. nextTick callbacks always run first.
How do you handle an unhandled promise rejection in Node?
process.on("unhandledRejection", (reason, promise) => {
console.error("Unhandled rejection:", reason);
// log it, alert, and decide whether to exit
});Without a handler, Node will log a warning and, in newer versions, terminate the process by default. Catching it explicitly lets you log the error properly and decide whether the process should actually crash or recover.
What's the difference between require() and import?
require() is CommonJS — synchronous, and can be called conditionally anywhere in a file. import is the ES Modules syntax — statically analyzed, hoisted to the top, and asynchronous under the hood. Node supports both, but mixing them in the same file requires care around file extensions and package.json's "type" field.
How would you scale a Node.js app across multiple CPU cores?
Since Node runs your code on one thread, one process only uses one core. The built-in cluster module (or a process manager like PM2) forks multiple worker processes, each running its own event loop, with incoming connections load-balanced across them.
React interview questions (the short version)
React is usually the deepest part of a MERN interview, and it deserves more space than a quick list can give it. Here are four to get you oriented:
What's the difference between state and props?
Props are passed into a component from its parent and are read-only from the component's own perspective. State is data the component owns and can update itself, typically via useState or useReducer.
Why do list items need a stable key prop?
React uses the key to match items between renders and decide what to reuse versus recreate. An unstable key (like array index on a reorderable list) can cause React to mix up which DOM node belongs to which item, leading to subtle bugs in state tied to that item.
What causes unnecessary re-renders in React?
The most common cause is passing a new object, array, or function reference as a prop on every parent render — even if the values are logically the same, a memoized child sees a new reference and re-renders anyway.
What's the difference between useEffect and useLayoutEffect?
useEffect runs after the browser paints. useLayoutEffect runs synchronously before paint, which matters when you need to measure or adjust the DOM without a visible flicker.
That's the short version — for a much deeper set of React-specific interview questions with code examples and analogies, see the full guide. Browse the React interview prep guide →
"You don't rise to the level of your goals. You fall to the level of your systems."— James Clear
How to actually use this list
Reading through this once won't make it stick. Pick the layer you're weakest on, and for the React section specifically, don't just read the answer — write the code yourself and check it against real tests instead of trusting your own read of whether it's correct.
Ready to test what you actually know? Try a React coding challenge →
Frequently asked questions
What are common MERN stack interview questions?
MERN stack interview questions typically span all four layers — MongoDB (schema design, indexing, aggregation), Express (middleware, routing, error handling), React (hooks, rendering, state), and Node.js (the event loop, async patterns, scaling). Strong candidates can speak to all four, not just React.
Is a MERN stack interview mostly about React?
No — while React often gets the most attention, interviewers commonly test MongoDB schema decisions, Express middleware and error handling, and Node.js concepts like the event loop just as heavily, especially for full-stack roles.
What should a MERN stack developer study before an interview?
Focus on where interview questions usually surprise people: MongoDB indexing and embed-vs-reference decisions, Express middleware and error-handling patterns, Node's event loop and async behavior, and React's rendering and hooks behavior — not just React alone.
What is the difference between MongoDB and a relational database, in an interview context?
MongoDB stores flexible JSON-like documents instead of fixed-schema rows, often embedding related data instead of joining across tables. Interviewers usually want to hear you reason about when to embed versus reference data, not just recite the definition.
How is Node.js single-threaded but still handles many requests?
Your JavaScript code runs on a single thread, but Node uses a thread pool under the hood (via libuv) for I/O operations, and the event loop processes completed callbacks once the current call stack is empty — letting Node handle concurrency without multiple threads for your code.