Q1. How does MongoDB differ from a relational database?
MongoDB is a document database. Data is stored as flexible BSON documents inside collections instead of rows in tables with a fixed schema. Each document can have its own...
Technical Question Bank · Peer-Reviewed
Search and filter frequently asked interview questions across technical, programming, and behavioral domains. Tailor your interview preparation by difficulty for freshers or experienced developers (10 available).
MongoDB is a document database. Data is stored as flexible BSON documents inside collections instead of rows in tables with a fixed schema. Each document can have its own...
Embed when the child data is always read with the parent, is bounded in size, and belongs to that parent. Reference when the child is large, unbounded, or shared across m...
An index is a B-tree structure storing a sorted subset of a collection's fields, letting the planner find documents without scanning everything. Without an index a query ...
Pipelines pass documents through stages, transforming them step by step. ```js db.orders.aggregate([ { $match: { status: "paid" } }, { $unwind: "$items" }, { $group: { _i...
$lookup performs a left outer join against another collection in the same database. The basic form matches localField against foreignField and returns matches in an "as" ...
Sharding horizontally partitions a collection across mongos routers and shards. You choose a shard key, and MongoDB splits the key space into chunks distributed and balan...
A replica set is a group of nodes holding the same data: one primary and two or more secondaries. All writes go to the primary. Secondaries replicate the oplog and can se...
Write concern controls how many nodes must acknowledge a write before it counts as successful. w:1 means the primary acknowledged it; w:"majority" means a majority of rep...
The answer depends on the size of the "many" side and the access pattern. One-to-few: embed an array of subdocuments. A user with a handful of addresses embeds them, so o...
Use find for simple filtering, projection, sorting and pagination on a single collection. It is lightweight and uses indexes efficiently. Use aggregate when you must tran...
HireXTech uses essential storage to remember your study preferences and third-party advertising cookies via Google AdSense in compliance with GDPR. You can choose to enable essential cookies only or accept all cookies. Read our Privacy Policy.