0% found this document useful (0 votes)
285 views15 pages

FSD Unit - 3 - Part-1

Full stack development

Uploaded by

pooja.amanchi
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)
285 views15 pages

FSD Unit - 3 - Part-1

Full stack development

Uploaded by

pooja.amanchi
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/ 15

Course Code: CS712PE

Unit -3 Part-1
Full Stack Development
By B. Lokesh Joel

https://www.softsuave.com/blog/key-trends-in-full-stack-development/
Unit-3: MongoDB
• Need of NoSQL, • Managing Collections,

• Understanding MongoDB, • Adding the MongoDB Driver to


Node.js,
• MongoDB Data Types,
• Connecting to MongoDB from Node.js,
• Planning Your Data Model,
• Understanding the Objects Used in the
• Building the MongoDB Environment, MongoDB Node.js Driver,

• Administering User Accounts, • Accessing and Manipulating Databases,

• Configuring Access Control, • Accessing and Manipulating


Collections
• Administering Databases,
SQL vs NoSQL

SQL (Structured Query Language) NoSQL (Not Only SQL)

Database Database

Collection
Row/Record Document
Table
Column

id name email password

21 Lokesh Lokesh@mgit.ac.in pass1234

Field
Backend Data Store and MongoDB
▪ Importance of Backend Data Store:
– The backend data store manages data like user account information,
shopping carts, blogs, and comments.
– It ensures accuracy, speed, and reliability in storing and retrieving data,
which is crucial for web applications.
– Common data storage solutions include:
• Direct file system storage
• Relational databases
• NoSQL databases
Why NoSQL?
▪ NoSQL (Not Only SQL) is a type of database technology that offers more flexibility than traditional SQL
databases. The key reasons for using NoSQL are:
– 1. Simplified Designs:
• NoSQL doesn’t require a strict structure like SQL, allowing developers to build data models that better suit their
applications.

– 2. Horizontal Scaling:
• NoSQL scales horizontally, meaning you can add more servers to handle larger data and more traffic, unlike SQL, which
requires more power on a single server..

– 3. More Control Over Data Availability::


• NoSQL offers flexibility in ensuring data is always available, even across multiple servers, making it reliable for constant
access.

– 4. Flexible Data Models:


• NoSQL supports various data types (like documents or key-value pairs) that fit better with how applications use data,
offering more adaptability.
Types of NoSQL Databases:
▪ HBase: Column structure
▪ Redis: Key/value structure
▪ Neo4j: Graph structure
▪ MongoDB: Document model, chosen for its ease of use,
flexibility, and scalability.
MongoDB Overview:
▪ MongoDB is a NoSQL database that uses a document model
to store data.
▪ Key features include:
– High performance
– High availability
– Automatic scaling

▪ MongoDB is widely supported and easy to install.


Collections in MongoDB:
▪ A collection is a group of related documents, similar to a table in
an SQL database.
▪ Unlike SQL, collections do not have a strict schema; instead,
documents in the same collection can have different structures.
▪ This allows flexibility and reduces the need for splitting data into
multiple tables.
Documents in MongoDB:
▪ A document is a representation of a single entity of data in the
MongoDB database.
▪ A collection consists of multiple related documents, unlike SQL
where rows are flat and rigid in structure.
▪ MongoDB documents are more flexible, allowing for embedded
subdocuments, providing a data model that is closer to real-world
application data.
Documents in MongoDB:
▪ Difference from SQL Rows:
– SQL rows are flat, meaning each row has a fixed number of columns.
– MongoDB documents can contain embedded subdocuments, arrays, and nested
objects, which gives MongoDB a more flexible and hierarchical structure
compared to SQL’s row-based approach.

▪ BSON Format:
– Documents in MongoDB are stored as BSON (Binary JSON), which uses field
pairs similar to JavaScript objects.
– This close relationship with JavaScript simplifies the process of converting
MongoDB records back into JavaScript objects, especially in Node.js applications.
Documents in MongoDB:

• The document includes multiple data types such as strings, integers, arrays,
and nested subdocuments (objects).
Documents in MongoDB:
▪ Field Name Restrictions: ▪ Document Size Limitation:
– Field names in MongoDB cannot contain: – MongoDB limits document size to 16MB to prevent
– Null characters excessive use of RAM and intensive file system
queries.
– Dots (.)
– While most applications won't approach this limit,
– Dollar signs ($)
it’s important to keep it in mind when designing
– The _id field is reserved for a unique Object ID for complex data structures that may contain large files.
each document.

▪ _id Field Structure:


– The _id field is automatically generated and consists
of:
• A 4-byte value representing seconds since the Unix
epoch.
• A 3-byte machine identifier.
• A 2-byte process ID.
• A 3-byte counter, starting with a random value.
MongoDB Data Types:
▪ MongoDB supports a variety of data types stored in BSON
format, closely matching JavaScript types. These data types
include:
MongoDB Data Types:
▪ BSON Data Type Comparison Order:
Unit-3
Part-2 By B. Lokesh Joel

15

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy