Search This Blog

Friday, September 6, 2024

Q1-Q5

Q1: What is MongoDB. Tell me its key features?
Q2: Give example of all NoSQL databases present. Azure service for them. 
Q3: What is MongoDB and when would you use it?
Q4: How does MongoDB achieve horizontal scalability?
Q5: What are Replica Sets in MongoDB? Why are they important?

-----------------------------------------------------------------------------------------------------------------------------------------
Q1: What is MongoDB. Tell me its key features?

Answer:
Mongo DB is a popular NoSQL database. It stores in data in JSON like document schemas. 

Key features of MongoDB
1. Document Oriented: Stores data in document similar to Json Formats
2. Flexible Schema: You are allowed to store different types of data in a same collection. 
3. Horizontal Scaling: Very good in horizontal scaling through Sharding. 
4. Indexing: Support various types of indexing for performance. 

-----------------------------------------------------------------------------------------------------------------------------------------
Q2: Give example of all NoSQL databases present. Azure service for them. 

Answer:

1. Document DB/ BSON/ JSON: MongoDB, Azure CosmosDB for MongoDB
2. Key-Value:  Redis, Dynamo DB, Azure Table Storage
2. Wide Cloumn: Hbase, Azure CosmosDB
3. Graph database: Azure CosmosDB for Gramlin

-----------------------------------------------------------------------------------------------------------------------------------------
Q3: What is MongoDB and when would you use it?

Answer:
MongoDB is a document-oriented NoSQL database designed for scalability and flexibility. Unlike relational databases, it stores data in BSON (binary JSON) documents, which allows for dynamic schemas.
From an architect’s perspective, I recommend MongoDB for use cases requiring:

1. Rapid schema evolution (e.g., product catalogs, IoT, user profiles).
2. High write throughput and horizontal scalability via sharding.
3. Polyglot persistence, where parts of the system need unstructured or semi-structured storage.
-----------------------------------------------------------------------------------------------------------------------------------------
Q4: How does MongoDB achieve horizontal scalability?

Answer:
MongoDB scales horizontally using sharding. Data is distributed across multiple shards using a shard key, and the config servers maintain metadata about data distribution.

As an architect, choosing the right shard key is critical — a poorly chosen one can lead to data skew or hot shards, causing performance bottlenecks. For large-scale systems, I’d design shard keys that balance read/write load and align with access patterns, such as a hashed key for write-heavy workloads.
-----------------------------------------------------------------------------------------------------------------------------------------
Q5: What are Replica Sets in MongoDB? Why are they important?

Answer:
A replica set is a cluster of MongoDB servers that provide redundancy and high availability. It consists of one primary and multiple secondaries. The primary handles writes, while secondaries replicate data asynchronously.
From an architect’s lens:

Replica sets ensure fault tolerance (automatic failover).

They support geo-distribution (e.g., read from nearest secondary for latency reduction).

For mission-critical apps, I’d design replication across availability zones or regions to ensure disaster recovery.
-----------------------------------------------------------------------------------------------------------------------------------------


No comments:

Post a Comment

Q6-Q10

Q6:  What is the difference between MongoDB and a relational database? Q7:  What are the limitations of MongoDB? How do you handle them? Q8:...