0% found this document useful (0 votes)
1K views21 pages

Emerging Research Trends in Database Systems

The document discusses emerging research trends in database systems, focusing on cloud-based databases, NoSQL databases, and JSON as a data format. It highlights the benefits of cloud databases, the characteristics of NoSQL databases, and the significance of big data technologies in modern applications. Additionally, it provides a step-by-step guide on creating a MongoDB database using MongoDB Atlas.

Uploaded by

fareehasaleem934
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)
1K views21 pages

Emerging Research Trends in Database Systems

The document discusses emerging research trends in database systems, focusing on cloud-based databases, NoSQL databases, and JSON as a data format. It highlights the benefits of cloud databases, the characteristics of NoSQL databases, and the significance of big data technologies in modern applications. Additionally, it provides a step-by-step guide on creating a MongoDB database using MongoDB Atlas.

Uploaded by

fareehasaleem934
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

Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

Week 11: Emerging Research Trends in Database Systems

Cloud-Based Databases

What Are Cloud-Based Databases?

A cloud-based database is a database that runs on a cloud computing platform, rather than on physical
hardware or a traditional on-premises server.

It is accessible over the internet and can be managed, scaled, and backed up through the cloud
provider’s infrastructure.

These are databases that run on cloud computing platforms like AWS, Azure, or Google Cloud.
Instead of hosting a database on a local server, cloud databases are managed and accessed over
the internet.

Examples:

 Amazon RDS (Relational Database Service)


 Google Cloud Firestore
 MongoDB Atlas ( MongoDB is the world's most popular NoSQL database)

MongoDB is a NoSQL document database primarily used for storing and managing data
in a flexible, document-oriented format. It's popular for applications that require
scalability, high availability, and can handle large volumes of structured and unstructured
data. (NoSQL distributed database program) MongoDB is a document database and can
be installed locally or hosted in the cloud.

MongoDB Atlas offers a free tier that allows users to get started with the cloud database
service without incurring any costs. This free tier is ideal for learning, exploring, and
testing use cases.

Benefits:

 Scalable
 Accessible from anywhere
 Reduced maintenance (since the cloud provider often handles updates and backups)

2. Data Storage Systems on the Cloud

This refers more broadly to any method of storing data using cloud services—not just databases.
Think files, videos, backups, etc.

Examples:
Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

 Amazon S3 (Simple Storage Service)


 Google Cloud Storage
 Dropbox, OneDrive, and Google Drive (for personal and enterprise use)

 Storing static assets (like images, CSS, JS for websites)


 Backups and disaster recovery
 Content distribution via CDNs

1. JavaScript Object Notation (JSON)

What is JSON? (JavaScript Object Notation)

JSON is a lightweight data format used for storing and exchanging data. It’s easy for humans to read
and write, and easy for machines to parse and generate.

Key Characteristics:

 Based on JavaScript syntax, but used by many programming languages (Python, Java, C#, etc.)
 Text-based format (can be stored in .json files or transmitted over a network)
 Ideal for data exchange between client and server (especially in web apps and APIs)

JSON Structure:

 Data is represented in key-value pairs


 Keys are always strings
 Values can be:
o String
o Number
o Boolean
o Array
o Object
o null

Example JSON:
json
CopyEdit
{
"name": "Alice",
"age": 30,
"isMember": true,
"email": "alice@[Link]",
"hobbies": ["reading", "gaming", "hiking"],
"address": {
"city": "New York",
"zip": "10001"
Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

}
}

 This JSON contains:


o Strings ("name", "email", "city")
o Numbers ("age")
o Boolean ("isMember")
o Array ("hobbies")
o Nested object ("address")

Where is JSON Used?

Use Case Example

Web APIs Sending data between client/server

Configuration files [Link] in [Link] apps

Databases MongoDB stores data in BSON (JSON-like)

Mobile & Web apps For saving user data, preferences, etc.

Data exchange formats Between services in microservice apps

2.

JSON is a lightweight data-interchange format that's easy for humans to read and write, and easy
for machines to parse and generate. It's often used for APIs and configuration files.

Example:

json
CopyEdit
{
"name": "Alice",
"age": 30,
"isMember": true
}

Used for:

 Sending data between a server and a web app


 Configuration files (like [Link])
 Storing structured data in NoSQL databases like MongoDB
Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

What is a NoSQL Database?

NoSQL (Not Only SQL) databases are a broad category of database systems that differ from
traditional relational databases (like MySQL or PostgreSQL). Instead of using structured tables
and SQL, NoSQL databases are designed to store, retrieve, and manage data in more flexible
ways.

They are often used for:

 Handling large volumes of data


 Supporting real-time web apps
 Scaling out across many servers
 Dealing with unstructured or semi-structured data

What is PostgreSQL?
PostgreSQL (often just called Postgres) is a powerful, open-source relational database
management system (RDBMS). It’s known for:

 Strict ACID compliance (Atomicity, Consistency, Isolation, Durability)


 Extensibility (you can define your own data types, functions, etc.)
 Strong support for SQL standards
 Being battle-tested in production for decades

Key Features

 Relational: Uses tables, rows, columns, and SQL for data modeling
 ACID Transactions: Ensures data integrity
 Advanced Queries: Supports window functions, CTEs, full-text search, JSONB, and
more
 Indexes: B-tree, GIN, GiST, SP-GiST, BRIN
 Concurrency: MVCC (Multiversion Concurrency Control) enables high performance
with many users
 Extensible: Custom data types, operators, languages, etc.
 Foreign Data Wrappers (FDW): Connect to other databases (even NoSQL systems like
MongoDB)

Popular Use Cases

 Enterprise applications
 Data warehousing
 Geospatial apps (with PostGIS)
 Web applications (e.g., Django, Rails, [Link] backends)
 APIs that need transactional support and strong consistency
Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

PostgreSQL vs NoSQL

Feature PostgreSQL NoSQL


Schema Strict, defined Flexible / schema-less
Consistency Strong (ACID compliant) Often eventual consistency
Scalability Vertical (can be horizontal) Horizontal (easier to scale out)
Query Language SQL Varies (proprietary or API-based)
Use Case Fit Structured data, transactions Big data, unstructured data

Main Types of NoSQL Databases

1. Document Stores
o Data stored as documents (usually JSON or BSON)
o Schema-less and flexible
2. Example: MongoDB, Cassandra( Apache Cassandra is an open-source, distributed NoSQL
database designed for handling large amounts of data across many commodity servers,
providing high availability with no single point of failure. It was originally developed by Facebook
and is now an Apache project)
3. Key-Value Stores
o Data stored as key-value pairs (like a dictionary)
o Super fast for lookups
o Example: Redis, DynamoDB
4. Column-Family Stores
o Data stored in columns rather than rows (good for analytical queries)
o Suitable for huge datasets with predictable queries
o Example: Apache Cassandra, HBase
5. Graph Databases
o Data stored as nodes and relationships (edges)
o Ideal for interconnected data like social networks
o Example: Neo4j, ArangoDB

Benefits of NoSQL Databases

 Scalability: Horizontally scalable (can grow by adding servers)


 Flexibility: Schema-less or dynamic schemas
 Performance: Optimized for specific data access patterns
 Big Data Ready: Excellent at handling large volumes of unstructured data

1. Schema-less:

 No Fixed Structure: A schema-less database doesn’t require a predefined schema (like a


table structure in relational databases) before data is stored. This means you don’t need to
specify the data types, relationships, or column names upfront.
Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

 Dynamic Data: Data can be inserted into the database without a fixed format, and
different records can have different attributes. This is especially useful in environments
where the data model is constantly evolving or not fully known ahead of time.
 Example:
o In a relational database (like MySQL or PostgreSQL), you would need to define
tables, columns, and data types before storing data (e.g., a table for "users" might
have columns for "id", "name", "email", etc.).
o In Cassandra or other NoSQL databases, you can insert data with different
structures into the same table. For example, one record might have fields for "id"
and "name", while another record might have "id", "name", and "address". The
database will not require these fields to be defined in advance.

2. Flexible:

 Adaptable to Changes: A flexible database allows for easy modification of the data
structure without requiring downtime or complicated schema migrations. You can add
new fields, remove existing ones, or change the data model on the fly without breaking
the system.
 No Need for Rigid Constraints: Unlike traditional relational databases, which enforce
strict rules (like primary keys, foreign keys, and data types), schema-less systems provide
more freedom for developers to work with diverse and evolving data formats.
 Example:
o In a relational database, adding a new column to a table (e.g., adding a
"phone_number" column to the "users" table) might involve migration scripts,
database downtime, or complex operations.
o In a NoSQL database like Cassandra, you can simply insert new data with
additional fields without needing to modify any structure. If one "user" record
includes a "phone_number" and another doesn’t, the system will handle both
cases

Common Uses

 Real-time analytics (e.g., time series data)


 Personalization engines and recommendations
 Social networks and graph-based data
 Internet of Things (IoT) applications
 Content management systems (CMS)
 Mobile apps and gaming backends

Big Data Technologies, and their relevance in modern


databases
Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

What is Big Data?

Big Data refers to datasets that are too large, fast, or complex for traditional databases to
handle effectively. It’s commonly described using the 3 Vs (now often expanded to 5 or more):

 Volume – Huge amounts of data


 Velocity – Data generated and processed in real-time
 Variety – Structured, semi-structured, unstructured data
 Veracity – Trustworthiness of the data
 Value – Usefulness of the data

Key Big Data Technologies

Here’s a rundown of the major players and tools:

Category Technology Purpose / Relevance


Storage &
Hadoop HDFS Distributed storage of massive datasets
Processing
In-memory distributed data processing (faster than
Apache Spark
Hadoop)
Apache Flink Stream processing, real-time analytics
Apache
Databases Scalable NoSQL database for write-heavy workloads
Cassandra
MongoDB Document store, schema-less, flexible
HBase Column-family database built on Hadoop
Amazon Redshift Cloud data warehouse, great for analytics
Google BigQuery Serverless, scalable analytics database
Streaming Apache Kafka Distributed event streaming platform
Apache Pulsar Scalable messaging system for data pipelines

Relevance in Modern Databases

Modern applications generate enormous amounts of data in real time — think IoT sensors, e-
commerce, social media, financial systems. Big Data technologies:

 Scale horizontally to manage ever-growing datasets


 Enable real-time analytics and decision-making
 Handle diverse data formats: logs, videos, transactions, documents
 Power AI/ML pipelines, data lakes, and cloud data platforms
Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

Examples of Real-World Usage

 Netflix uses Apache Kafka + Flink for real-time data processing


 Uber uses Hadoop and Presto for analytics and reporting
 Spotify uses Google BigQuery for querying massive event logs
 Amazon uses Redshift for large-scale business intelligence

Integration with Traditional/Modern DBs

Many Big Data tools complement modern databases:

 PostgreSQL can use FDWs to access big data systems like Hadoop ,Hadoop is an open-
source framework used for storing and processing large sets of data in a distributed
computing environment.( A distributed computing environment refers to a system where multiple
computers, often geographically dispersed, work together to achieve a common goal. These
computers share resources, data, and tasks to solve problems or perform computations more
efficiently)
 It's designed to handle big data workloads across clusters of computers using simple
programming models.
 MongoDB integrates with Kafka(Kafka has become one of the most popular tools for handling
large-scale data streaming in distributed systems. )
 Data warehouses like Snowflake(Snowflake is a cloud-based data platform that provides data
warehousing, data sharing, and data analytics capabilities. It is designed to enable businesses to
store, analyze, and share large volumes of structured and semi-structured data in a highly scalable
and flexible environment. ) can import data from Spark or Kafka

What is PL/pgSQL?

PL/pgSQL stands for Procedural Language/PostgreSQL. It's PostgreSQL’s built-in


procedural language, allowing you to write:

 Stored procedures
 Functions
 Triggers
 Control structures (like loops, IF statements, etc.)

It blends SQL with traditional programming features, giving you much more flexibility in how
you manipulate and respond to data.

Key Features

 Variables & Constants


Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

 Control Flow: IF, LOOP, WHILE, FOR, CASE


 Exception Handling: BEGIN ... EXCEPTION ... END
 Row and Record Types: Work with full rows of data easily
 Triggers: React to data changes (INSERT, UPDATE, DELETE)
 Modular Design: Create reusable and encapsulated logic

Use Cases

 Business logic inside the database


 Automated data transformations
 Complex validations
 Auditing with triggers
 Batch processing without needing external code

Things to Keep in Mind

 It runs inside the database, so bad code can hog resources.


 Great for logic that must stay close to the data (e.g., security, atomic operations).
 Best for transactional or data-intensive operations — not general-purpose scripting.

PL/pgSQL vs Other PLs in PostgreSQL

Postgres supports other languages too (e.g., PL/Python, PL/Perl, PL/v8), but PL/pgSQL is:

 Natively supported
 Easiest to deploy (no extension needed)
 Best for traditional DB logic


****step-by-step
with full detail on how to create your own
MongoDB database using MongoDB Atlas,
insert data, and even optionally connect it to an app later.

Full Details

STEP 1: Sign Up for MongoDB Atlas

1. Go to MongoDB Atlas:
[Link]
2. Click "Start Free"
3. Create an account:
o You can sign up using your email, Google, or GitHub account.
Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

4. Once signed in, you’ll land in the MongoDB Atlas dashboard.

STEP 2: Create a Free Cluster

MongoDB Atlas provides a free shared cluster for you to try it out.

1. Click “Build a Database”


2. In the Cluster Tier step, choose:
o Cloud Provider: AWS (default is fine)
o Region: Choose one close to you (e.g., us-east-1)
3. Select "M0" — Free Tier Cluster.
4. Give your cluster a name, like: Cluster0 (or anything you like)
5. Click Create Cluster — this will take 1–3 minutes to deploy.

STEP 3: Create Database and Collection

Once your cluster is deployed:

1. On the left panel, click “Database” > “Browse Collections”


2. Click the “Add My Own Data” button
3. Enter:
o Database Name: myFirstDB
o Collection Name: users
4. Click Create

This creates a database named myFirstDB and a collection named users (like a table in SQL).

STEP 4: Insert Your First Document

Now we’ll add some data manually.

1. Click on the users collection.


2. Click “Insert Document”
3. Paste this example JSON document:

json
CopyEdit
{
"name": "Alice Johnson",
"email": "alice@[Link]",
"age": 28,
"isMember": true,
"address": {
"city": "San Francisco",
"zip": "94105"
},
"hobbies": ["reading", "hiking", "coding"]
}
Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

4. Click Insert.

Your document is now saved in the cloud-based database!

STEP 5: Set Up Database Access

To connect from outside (e.g., from code), we need to allow access.

1. Click “Database” > “Connect”


2. Choose “Connect your application”
3. Set a username and password (e.g., dbuser, password secure123 — write it down!)
4. In the IP Access List, allow access by clicking:
o “Add My Current IP Address” or [Link]/0 to allow all
5. Click Create User and Confirm

STEP 6: Copy Your Connection String

1. Go to Database > Connect > Drivers


2. Select your driver (e.g., [Link], version 4.x)
3. You’ll see a connection string like this:

bash
CopyEdit
mongodb+srv://dbuser:secure123@[Link]/myFirstDB?retryWrites=tru
e&w=majority

Replace dbuser and secure123 with your real credentials.

This string can now be used in your [Link], Python, or any app to connect to your database.

(Optional) STEP 7: Connect Using [Link]

Here’s a quick [Link] example to connect and fetch users:

Requirements:

 [Link] installed
 npm install mongodb to install the driver

Code Example:
javascript
CopyEdit
const { MongoClient } = require("mongodb");

const uri = "your_connection_string_here";


Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

const client = new MongoClient(uri);

async function run() {


try {
await [Link]();
const db = [Link]("myFirstDB");
const collection = [Link]("users");

const users = await [Link]().toArray();


[Link]("Users:", users);
} finally {
await [Link]();
}
}

run().catch([Link]);

 Created a cloud-based MongoDB database


 Created a collection
 Inserted a document
 Got a connection string
 (Optionally) connected to it with [Link]

What Are Cloud-Based Databases?

A cloud-based database is a database that runs on a cloud computing platform, rather than on physical
hardware or a traditional on-premises server.

It is accessible over the internet and can be managed, scaled, and backed up through the cloud
provider’s infrastructure.

Key Characteristics:

 Hosted in the cloud (e.g., AWS, Azure, Google Cloud)


 Accessed over the internet
 Scalable (can grow as your app or user base grows)
 Managed or self-managed (providers may offer full management or tools to do it yourself)

Two Types:

1. Relational Cloud Databases (SQL-based)


Use structured schemas, like traditional databases.
Examples:
o Amazon RDS (MySQL, PostgreSQL, SQL Server)
o Google Cloud SQL
o Azure SQL Database
2. Non-Relational (NoSQL) Cloud Databases
Schema-less or flexible schema, good for unstructured or semi-structured data.
Examples:
Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

o MongoDB Atlas (document-based)


o Amazon DynamoDB (key-value store)
o Google Firestore (document store)

Why Use Cloud-Based Databases?

Feature Benefit

Scalability Easily handle growth without hardware upgrades

Availability Built-in redundancy and backups for high uptime

Accessibility Access from anywhere with internet

Security Encrypted storage, role-based access, network protection

Lower Costs Pay only for what you use (no need for server maintenance)

Uses:

 Web and mobile app backends


 E-commerce platforms
 IoT data storage
 Real-time analytics
 Remote-access business apps

GCP (Google Cloud Platform) and how it handles cloud-based databases. GCP offers several powerful,
scalable database solutions — both SQL and NoSQL — all hosted in the cloud.

Cloud-Based Databases on Google Cloud (GCP)

Google Cloud provides fully managed, scalable databases that integrate seamlessly with other GCP
services like Compute Engine, App Engine, Cloud Functions, etc.

1. Cloud SQL (Relational)

A fully managed relational database service for:

 MySQL
 PostgreSQL
 SQL Server

Features:
Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

 Automated backups and replication


 High availability (multi-zone)
 Secure and compliant

Use case: Legacy apps, ERP systems, websites that require SQL queries.

2. Cloud Firestore (NoSQL, Document Database)

A flexible, scalable NoSQL database designed for real-time applications.

Features:

 Stores data in documents (similar to JSON)


 Real-time sync across devices
 Built for mobile and web apps (especially with Firebase)

Use case: Chat apps, collaborative tools, mobile games, real-time dashboards.

3. Cloud Bigtable (NoSQL, Wide-Column)

Used for very large datasets with low latency.

Features:

 Designed for big data and analytics


 Integrates with Apache HBase
 Massive horizontal scaling

Use case: Time-series data, financial data, IoT telemetry.

4. Cloud Spanner (Relational, Horizontally Scalable)

A globally distributed SQL database — like the power of NoSQL but with relational features.

Features:

 Strong consistency
 Horizontal scalability
 Supports ANSI SQL

Use case: Global financial apps, supply chain systems, apps needing both scalability and SQL.

5. Firestore vs. Realtime Database (Firebase Tools)


Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

Feature Firestore Realtime Database

Data Model Document-based Tree-based (JSON)

Querying Advanced queries Basic filtering

Scalability High Medium

Offline Support Yes Yes

Pricing Based on reads/writes Based on data size

What is MongoDB?

MongoDB is a NoSQL database that stores data in a flexible, JSON-like format called BSON (Binary
JSON). Unlike traditional relational databases (SQL), MongoDB is document-oriented, which means it
stores data in documents instead of rows and tables.

Key Features of MongoDB:

Feature Description

NoSQL Not based on tables or SQL queries; more flexible data storage.

Document-Oriented Stores data in JSON-like documents.

Schema-Less Documents in a collection can have different structures.

High Performance Fast read/write operations.

Scalable Easy to scale horizontally across servers.

Cross-platform Works on Windows, macOS, Linux, and cloud platforms.

Example MongoDB Document:


json
CopyEdit
{
"name": "Alice",
"age": 30,
"email": "alice@[Link]",
"hobbies": ["reading", "hiking"],
"address": {
Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

"city": "New York",


"zip": "10001"
}
}

This is a single record (document) in MongoDB. These documents are stored inside collections, which
are similar to tables in SQL.

MongoDB Terminology (Compared to SQL):

MongoDB SQL Equivalent

Document Row

Collection Table

Field Column

_id Primary Key

BSON JSON with extra types

 Real-time applications
 Content management systems
 IoT and sensor data
 E-commerce product catalogs
 User profiles and authentication systems

MongoDB Atlas:

MongoDB also offers a cloud version called MongoDB Atlas, which is fully managed and runs on AWS,
GCP, or Azure. You don’t have to set up your own server — just create a database online and connect
your app.

Steps to Create a MongoDB Database on MongoDB Atlas and


Connect Your App

Step 1: Create an Account on MongoDB Atlas

1. Go to MongoDB Atlas and sign up for a free account.


2. After signing up, log into the Atlas dashboard.

Step 2: Create a Cluster in MongoDB Atlas


Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

1. In the Atlas Dashboard, click on the "Build a Cluster" button.


2. Choose “M0” Free Tier Cluster for a free plan (great for small apps and learning).
3. Select the cloud provider (e.g., AWS, GCP, or Azure) and region (choose one closest to you).
4. Click Create Cluster. It will take a few minutes for the cluster to be ready.

Step 3: Set Up Database Access

1. Create a Database User:


o After your cluster is ready, go to the Database Access tab.
o Click Add New Database User.
o Set a username and password (keep these safe!).
o Set the database privileges (usually, "Read and Write to any database" is fine for
development).
2. Whitelist Your IP Address:
o Go to the Network Access tab.
o Click Add IP Address.
o Select “Allow access from anywhere ([Link]/0)” (not recommended for production,
but fine for testing).

Step 4: Get the Connection String

1. Go to the Clusters tab.


2. Click Connect on the cluster you just created.
3. Choose Connect your application.
4. Copy the connection string (it will look something like this):

bash
CopyEdit
mongodb+srv://<username>:<password>@[Link]/myFirstDB?retr
yWrites=true&w=majority

o Replace <username> and <password> with the credentials you created earlier.

Step 5: Install MongoDB Driver in Your [Link] App

Now, we’ll connect MongoDB to your [Link] app.

1. If you don't have a [Link] app yet, create a new one by running:

bash
CopyEdit
mkdir myapp
cd myapp
npm init -y
npm install express mongodb

2. Create a new file (e.g., [Link]) and add the following code to connect to MongoDB:
Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

Step 6: Connect MongoDB Atlas to Your App ([Link] Example)

[Link] ([Link]):
javascript
CopyEdit
const express = require('express');
const { MongoClient } = require('mongodb');

const app = express();


const port = 3000;

const uri =
"mongodb+srv://<username>:<password>@[Link]/myFirstDB?retryWrit
es=true&w=majority";

// Connect to MongoDB
async function connectToMongoDB() {
try {
const client = new MongoClient(uri);
await [Link]();
[Link]("Connected to MongoDB!");
const db = [Link]('myFirstDB');
const collection = [Link]('users');

// Insert a test user (optional)


await [Link]({ name: 'Alice', email:
'alice@[Link]' });

// Retrieve and log users (optional)


const users = await [Link]({}).toArray();
[Link](users);

// Close connection after some time


setTimeout(() => {
[Link]();
[Link]("Connection closed.");
}, 5000);
} catch (err) {
[Link]('Error connecting to MongoDB:', err);
}
}

connectToMongoDB();

[Link](port, () => {
[Link](`Server running at [Link]
});

Step 7: Run Your App

1. Open your terminal and navigate to your app folder.


2. Run the app:

bash
Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

CopyEdit
node [Link]

You should see:

 "Connected to MongoDB!" printed to the console.


 A new user will be added to your MongoDB database.
 The users from the users collection will be logged.

Step 8: Access Your Data via MongoDB Atlas

1. Go back to MongoDB Atlas.


2. Open your cluster and go to Database > Browse Collections.
3. You should see your myFirstDB and the users collection containing the data you inserted
from your app.

 Created a MongoDB database in MongoDB Atlas.


 Set up a database user and whitelisted your IP.
 Got the connection string to connect to MongoDB.
 Created a [Link] app that connects to MongoDB and stores/retrieves data.

2. Non-Relational (NoSQL) Cloud Databases

Definition:

NoSQL cloud databases are non-tabular databases designed to handle unstructured, semi-structured,
or variable-schema data. Unlike relational databases (which use rows, tables, and SQL), NoSQL
databases are more flexible and scalable — especially in the cloud.

They are commonly used in modern web and mobile applications, IoT, and big data platforms where
performance and scalability are critical.

Key Features:

Feature Description

Schema-less No fixed structure — each record can be different.

Horizontal scalability Can grow across servers easily (ideal for cloud scaling).

High performance Optimized for read/write speed at large scale.

Flexible data models Supports documents, key-value pairs, graphs, wide-columns, etc.
Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

Feature Description

Cloud-native Many are built to run on cloud platforms from the start.

Main Types of NoSQL Databases:

Type Description Example Systems

Document Stores data as JSON/BSON documents MongoDB, Firebase Firestore

Key-Value Data as key-value pairs Redis, Amazon DynamoDB

Column-Family Columns grouped by families, scalable Apache Cassandra, HBase

Graph Focus on relationships (nodes/edges) Neo4j, Amazon Neptune

Popular NoSQL Cloud Databases:

Service Type Cloud Platform

MongoDB Atlas Document Multi-cloud (AWS, GCP, Azure)

Amazon DynamoDB Key-Value AWS

Google Firestore Document GCP (Firebase)

Azure Cosmos DB Multi-model Microsoft Azure

Couchbase Cloud Document/Key Multi-cloud

Redis Enterprise Cloud Key-Value AWS, Azure, GCP

When to Use NoSQL Cloud Databases:

 When your data doesn’t fit into tables or changes frequently


 For high-speed reads/writes (real-time apps, chat apps, gaming)
 When you need horizontal scalability and cloud-native performance
 For large-scale distributed systems
 For storing logs, events, or user-generated content

Example: Firestore Document


Subject: DA&M BSIT 8th By: Muhammad Imran Afzal

json
CopyEdit
{
"userId": "12345",
"name": "Alice",
"interests": ["reading", "traveling"],
"lastLogin": "2025-04-20T[Link]Z"
}

Stored in Firestore (GCP) or MongoDB Atlas.

You might also like