[go: up one dir, main page]

0% found this document useful (0 votes)
19 views2 pages

MongoDB Interview Questions and Answers

The document provides a comprehensive overview of MongoDB, a NoSQL, document-oriented database, highlighting its key features such as schema-less architecture and high performance. It explains fundamental concepts like documents, collections, BSON, and the differences between embedded and referenced documents. Additionally, it covers CRUD operations, detailing methods for inserting, updating, and deleting documents in MongoDB.

Uploaded by

deeksha.23ai018
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views2 pages

MongoDB Interview Questions and Answers

The document provides a comprehensive overview of MongoDB, a NoSQL, document-oriented database, highlighting its key features such as schema-less architecture and high performance. It explains fundamental concepts like documents, collections, BSON, and the differences between embedded and referenced documents. Additionally, it covers CRUD operations, detailing methods for inserting, updating, and deleting documents in MongoDB.

Uploaded by

deeksha.23ai018
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

MongoDB Interview Questions and Answers

1. Basic Questions

Q: What is MongoDB?

A: MongoDB is a NoSQL, document-oriented database used for high volume data storage. It stores data in

flexible, JSON-like documents.

Q: What are the key features of MongoDB?

A: Features include schema-less architecture, high performance, scalability, replication, and indexing.

Q: How is MongoDB different from a relational database?

A: MongoDB uses documents instead of rows and collections instead of tables. It does not require a fixed

schema.

Q: What is a document in MongoDB?

A: A document is a data structure composed of field and value pairs, similar to JSON.

Q: What is a collection in MongoDB?

A: A collection is a group of MongoDB documents, similar to a table in RDBMS.

2. Data Model and Structure

Q: What is BSON in MongoDB?

A: BSON stands for Binary JSON, a binary-encoded serialization of JSON-like documents.

Q: How is data stored in MongoDB?

A: Data is stored as BSON documents in collections.

Q: What are embedded documents and referenced documents?

A: Embedded documents store data within a document; referenced documents use a reference to another

document.

Q: When should you use embedding vs referencing?

A: Embed when related data is frequently accessed together; reference when data is large or reused.

3. CRUD Operations

Q: How do you insert a document into a collection?

A: Use `db.collection.insertOne()` or `insertMany()`.

Q: How can you update a document in MongoDB?


MongoDB Interview Questions and Answers

A: Use `db.collection.updateOne()` or `updateMany()` with update operators like `$set`.

Q: How do you delete documents from a collection?

A: Use `db.collection.deleteOne()` or `deleteMany()`.

Q: Explain the difference between insertOne, insertMany, updateOne, and updateMany.

A: `insertOne`/`insertMany` insert single/multiple documents. `updateOne`/`updateMany` update one/multiple

documents.

You might also like