0% found this document useful (0 votes)
35 views3 pages

BDA3

The document provides a comprehensive overview of MongoDB, a NoSQL database that uses BSON documents for data storage, highlighting its advantages such as flexibility, scalability, and high availability through replication and sharding. It contrasts MongoDB with traditional RDBMS, detailing features like dynamic schema, lack of joins, and support for multi-document transactions. Additionally, it outlines various data types supported by MongoDB, along with its advantages and disadvantages.

Uploaded by

Prathishta Jain
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)
35 views3 pages

BDA3

The document provides a comprehensive overview of MongoDB, a NoSQL database that uses BSON documents for data storage, highlighting its advantages such as flexibility, scalability, and high availability through replication and sharding. It contrasts MongoDB with traditional RDBMS, detailing features like dynamic schema, lack of joins, and support for multi-document transactions. Additionally, it outlines various data types supported by MongoDB, along with its advantages and disadvantages.

Uploaded by

Prathishta Jain
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/ 3

Here's a detailed explanation of each of the listed topics from the Introduction to

MongoDB module, tailored to a 5-mark answer level. I’ve explained things simply, with
examples where needed, and included diagrams in text format for easier understanding.

1. MongoDB – Introduction

MongoDB is a NoSQL, document-oriented database. Unlike traditional RDBMS (which


stores data in tables), MongoDB stores data in JSON-like documents called BSON
(Binary JSON). It is designed for high availability, scalability, and performance.

Example Document:

"name": "Rahul",

"age": 22,

"course": "BDA"

MongoDB is schema-less, meaning documents in the same collection can have


different fields. This flexibility makes it popular for big data, real-time analytics, and
applications like IoT or social media platforms.

2. Comparison with RDBMS

Feature RDBMS MongoDB

Data Model Tables and Rows Collections and Documents

Schema Fixed schema Dynamic schema

Joins Supports complex joins No joins, uses embedded docs

Transactions ACID compliant Now supports multi-doc transactions

Scalability Vertical scaling Horizontal scaling (sharding)

Query Language SQL MongoDB Query Language (MQL)

3. Replication in MongoDB
Replication helps in data redundancy and high availability. MongoDB uses a replica
set, a group of MongoDB servers where:

• One acts as the primary (handles all write operations).

• Others are secondary (copies of primary data).

If the primary goes down, one of the secondaries is elected as the new primary
automatically.

Diagram:

[Primary]

[Secondary1] [Secondary2]

Replication ensures your database is always available, even during failures.

4. Sharding in MongoDB

Sharding is horizontal partitioning of data across multiple servers. It is used to handle


large-scale data by distributing it into chunks across shards.

Components of Sharding:

• Shard: Each shard holds part of the data.

• Mongos: Acts as a query router.

• Config Server: Stores metadata and routing info.

Diagram:

[Client] → [Mongos] → [Shard1, Shard2, Shard3]

Use Case: Social media platforms with millions of users and posts.

5. Data Types in MongoDB

MongoDB supports various data types similar to other databases, but some are unique
to BSON:

• String – "hello"

• Integer – NumberInt(25)

• Double – 25.6
• Boolean – true/false

• Date – ISODate("2023-05-01")

• ObjectId – Unique ID for each document

• Array – ["Java", "Python"]

• Embedded Document – { address: { city: "Mysuru", pincode: 570001 } }

6. Advantages and Disadvantages

Advantages:

• Schema-less – flexible document structure

• Easy to scale using sharding

• High performance and fast reads/writes

• Replication ensures data availability

Disadvantages:

• No join support like SQL (though lookup is available)

• Less suitable for complex transactions

• Consumes more memory (due to dynamic schema)

7. Features of MongoDB

• Document-oriented Storage: Stores data in BSON format.

• Schema-less: Collections don’t require uniform fields.

• Indexing: Supports fast queries with powerful indexing.

• Aggregation Framework: For complex data processing like SQL’s GROUP BY.

• Horizontal Scaling: Supports sharding for big data.

• High Availability: Built-in replication via replica sets.

• Flexible Deployment: Can be used on cloud, local servers, or containers.

Let me know if you'd like this in a Word file or want diagrams/images added!

You might also like