Back to Tech Interviews

MongoDB NoSQL Interview Master

100+ MongoDB questions covering Aggregation Framework, Compound Indexes, Sharding, Replica Sets, WiredTiger engine, and Document Schema Design.

Total: 100 QuestionsLearned: 0 / 100 (0%)
Difficulty Filters

Tools & Options
Showing 100 of 100 questions
Beginner
What is MongoDB?

MongoDB is an open-source, document-oriented NoSQL database program. Instead of using tables and rows as in traditional relational databases, MongoDB uses JSON-like documents with optional schemas (BSON). It is designed for scalability, high performance, and high availability.

Beginner
What is a Document in MongoDB?

A document is the basic unit of data in MongoDB, analogous to a row in an RDBMS. Documents are composed of field-and-value pairs and are stored in BSON (Binary JSON) format.

{
  "name": "John Doe",
  "age": 30,
  "interests": ["coding", "reading"]
}
Beginner
What is a Collection in MongoDB?

A collection is a grouping of MongoDB documents. It is equivalent to a table in a relational database. Collections do not enforce a strict schema, although schema validation is possible.

Beginner
What is BSON?
Beginner
What are the primary advantages of MongoDB?
Beginner
What is the '_id' field in MongoDB?
Beginner
What is an ObjectId in MongoDB?
Beginner
How do you create a database in MongoDB?
Beginner
How do you insert a document into a collection?
Beginner
How do you find all documents in a collection?
Beginner
What is the difference between MongoDB and RDBMS?
Beginner
What is Namespace in MongoDB?
Beginner
How do you update a document in MongoDB?
Beginner
How do you delete a document?
Beginner
What is the purpose of the '$set' operator?
Beginner
What is the difference between findOne() and find()?
Beginner
How do you limit the number of results in MongoDB?
Beginner
How do you sort results in MongoDB?
Beginner
What is Projection in MongoDB?
Beginner
What is the use of the '$in' operator?
Beginner
How do you count the number of documents in a collection?
Beginner
What is an Index in MongoDB?
Beginner
What is a GridFS?
Beginner
What is the default port for MongoDB?
Beginner
What is the command to see all databases?
Intermediate
How do you perform a simple count in MongoDB?
Intermediate
What is an Aggregation Pipeline in MongoDB?
Intermediate
Explain the '$match' stage in Aggregation.
Intermediate
Explain the '$group' stage in Aggregation.
Intermediate
What is the difference between Embedding and Referencing in Schema Design?
Intermediate
What is a TTL (Time-To-Live) Index?
Intermediate
What is a Capped Collection?
Intermediate
What is the use of the '$lookup' operator?
Intermediate
How do you handle Transactions in MongoDB?
Intermediate
What are Covered Queries?
Intermediate
Explain the Concept of Sharding.
Intermediate
What is a Shard Key?
Intermediate
What is a Replica Set?
Intermediate
What is a Write Concern in MongoDB?
Intermediate
What is a Read Preference?
Intermediate
What is the purpose of the '$unwind' stage?
Intermediate
Explain the '$facet' stage in aggregation.
Intermediate
What is the difference between '$addFields' and '$project'?
Intermediate
What is a Compound Index?
Intermediate
What is a Partial Index?
Intermediate
How do you view index usage in MongoDB?
Intermediate
What is the 'oplog' (Operations Log)?
Intermediate
What is an Arbiter in a Replica Set?
Intermediate
How to backup and restore MongoDB databases?
Intermediate
What is the use of the '$out' stage in aggregation?
Advanced
Explain the difference between 2d and 2dsphere indexes.
Advanced
How does MongoDB handle data consistency?
Advanced
What is Joins in MongoDB?
Advanced
Explain the Working of 'Election' in Replica Sets.
Advanced
What are Change Streams?
Advanced
Explain the use of 'Hint' in MongoDB.
Advanced
What is the 'wiredTiger' storage engine?
Advanced
What are Orphaned Documents?
Advanced
What is the 'Journal' in MongoDB?
Advanced
Explain the 'Working Set' concept.
Advanced
What is a Sparse Index?
Advanced
Explain 'Mongoose' in the context of MongoDB.
Advanced
What is the 16MB Document Limit?
Advanced
Explain 'Horizontal' vs 'Vertical' Scaling.
Advanced
What is 'Read Concern' in MongoDB?
Advanced
Explain 'Map-Reduce' in MongoDB.
Advanced
What are 'Views' in MongoDB?
Advanced
What is 'Causal Consistency'?
Advanced
How to tune MongoDB performance?
Advanced
What is 'Write Strategy' for Sharding?
Advanced
Explain 'Balancing' in Sharded Clusters.
Advanced
What are 'Sessions' in MongoDB?
Advanced
How to monitor MongoDB?
Advanced
What is 'Schema Validation'?
Advanced
Explain 'Disk Compression' in WiredTiger.
Scenario
Scenario: How to find top 5 most expensive orders using aggregation?
Scenario
Scenario: How to calculate total revenue per category?
Scenario
Scenario: How to find users who have exactly 3 tags?
Scenario
Scenario: How to remove a field from all documents in a collection?
Scenario
Scenario: How to find documents where an array field contains a specific value?
Scenario
Scenario: How to perform a 'Full Text Search' for the word 'database'?
Scenario
Scenario: How to find documents with a field that is NOT null and exists?
Scenario
Scenario: How to increment a counter field by 1?
Scenario
Scenario: How to find documents where field A is greater than field B?
Scenario
Scenario: How to rename a field across all documents?
Scenario
Scenario: How to push an item to an array only if it doesn't already exist?
Scenario
Scenario: How to get the current date in an aggregation pipeline?
Scenario
Scenario: How to find documents that were created in the last 24 hours?
Scenario
Scenario: How to 'Join' users with their posts using aggregation?
Scenario
Scenario: How to filter a 'joined' array from $lookup?
Scenario
Scenario: How to flatten an array of objects into separate documents?
Scenario
Scenario: How to find the average age of users per city, but only for cities with more than 10 users?
Scenario
Scenario: How to update multiple fields in a single document based on conditions?
Scenario
Scenario: How to pull (remove) all occurrences of 'error' from an array?
Scenario
Scenario: How to find documents where a field is of a specific type (e.g., String)?
Scenario
Scenario: How to perform a 'Dry Run' of a deletion?
Scenario
Scenario: How to get the last 10 log entries?
Scenario
Scenario: How to search for coordinates within a 5km radius of a point?
Scenario
Scenario: You need a schema where one document contains 'many' others, potentially causing size issues. Solution?
Scenario
How to export a collection to a JSON file?

Technical Interview Mastery Blueprint

Proven methodologies and frameworks to succeed in technical and architecture rounds.

1. The Engineering STAR Technique

When responding to architectural or situational questions, structure your answer using Situation, Technical Constraint, Action, and Measurable Result. Rather than jumping straight to syntax, articulate the business problem, why certain patterns (e.g. caching, queuing, immutability) were selected over alternatives, and what latency or throughput improvements were achieved.

2. Defending Architectural Trade-Offs

Senior interviewers evaluate how you weigh trade-offs. Always explain why you chose an approach: e.g., memory overhead vs CPU cycle speed, consistency vs availability (CAP theorem), or normalized schemas vs denormalized fast reads. Stating the drawbacks of your own proposal demonstrates maturity and production experience.

3. Clean Code & Edge-Case Proactivity

In live-coding rounds, communicate your thinking aloud before typing. State edge cases explicitly: null or undefined inputs, extreme boundary values, concurrency races, and network timeouts. Writing modular, well-named functions with deterministic unit tests separates junior candidates from staff-level engineers.

4. Antipatterns to Avoid

Avoid reciting memorized definitions without practical context. Never dismiss non-functional requirements such as security (CSRF, injection, token rotation), observability (logging, metrics), and accessibility (ARIA, semantic standards). Always ask clarifying scope questions before writing complex implementations.

Continuous learning: Practice daily, mark completed questions as learned, and revisit difficult concepts.Explore All Interview Tracks →

Explore Related Tools

Hand-picked utilities and calculators related to this tool.

Related Tools