0% found this document useful (0 votes)
20 views16 pages

Mongodb Project

Uploaded by

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

Mongodb Project

Uploaded by

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

MONGODB PROJECT

SUPERMARKET DATABASE
NIIT ABUJA
JOSEPH IGBETAR
MMS-SE
MongoDB is a NoSQL database used to store large
quantities of complex and diverse data such as
product catalogs, logs and analytics.

Flexibility: Schema-less design supports dynamic


changes.
WHY
MONGODB Scalability: Handles large data volumes. efficiently

FOR THE
DATBASE? High Performance: Optimized for read and write
operations.

Document-Oriented: Ideal for complex,


hierarchical data structures like customer purchase
history or product categories.
The aim of the project is the creation and
population of a supermarket database using
MongoDB

OVERVIEW The key entities of the


database are:
Customers: Managing
customer details and
their purchase behavior.
Products: Maintaining
inventory, pricing, and
categorization.

AND SCOPE
OF
DATABASE
STRUCTURE Employees: Records
staff details, roles,
Relationship among
entities: The entities of
employment history, and the database are
salary. expressed by an Entity
Relationship Diagram.
MongoDB: NoSQL database for integral
data storage.

Node.js: JavaScript run-time for server-


side scripting.

TOOLS FOR
IMPLEMENTATION Visual Studio Code: Integrated
Development Environment (IDE) for
schema development.

EDrawMax: Creation of an Entity


Relationship diagram
The ER diagram consists of:
DIAGRAM EXPLANATION
• Cardinality and Relationships
1.Customer to Products: One
customer can buy many products,
Rectangles for entities (e.g., Customers, but each product belongs to one
Products, Employees). customer (1-to-many).
2.Products to Customer: Many
Diamonds for relationships (e.g., Buying,
Stock).
products can be bought by many
customers (many-to-many).
Ovals for attributes (linked to their respective 3.Employees to Customer: One
entities). staff member can manage many
customer purchases, but each
purchase is handled by one staff
Lines connecting entities via relationships,
annotated with cardinalities (e.g., 1-to-many, member (1-to-many).
many-to-many).
WHAT IS MONGODB
COMPASS?
•A graphical user interface (GUI) for MongoDB.
•Database as a service (DBaaS)
•Simplifies database creation querying, and management.

Key features:
•Visualize and explore data.
•Build queries interactively.
•Perform CRUD (Create, Read, Update, Delete) operations easily.
BENEFITS OF MONGODB
COMPASS
• 1. User-Friendly Interface • 3. Interactive Query Builder
• Intuitive, graphical interface for • Build and execute queries visually
managing MongoDB. without needing to know complex
• Ideal for users unfamiliar with the query syntax.
MongoDB shell or those who prefer • Real-time feedback to test and refine
visual interaction. queries.
• 2. Simplified Database Management
• 4. Data Import and Export
• Easily create, view, and modify
databases, collections, and documents
• Import data from JSON or CSV files
without writing commands. into collections with just a few clicks.
• Perform CRUD (Create, Read, Update, • Export data into various formats for
Delete) operations through a point-and- sharing or analysis.
click interface. • 5. Ideal for All Skill Levels
MONGODB COMPASS
DATABASE

CREATING A DATABASE ADDING COLLECTIONS

•Click on "Create Database":


•Located in the top-right corner of the
main page. •Select the database (e.g., SupermarketDB).
•Enter Database Name: •Click "Add My Collection".
•Example: SupermarketDB. •Provide a collection name:
•Enter Collection Name (required): •Example: Customers.
•Example: Products.
•Click "Create Database".
UPDATING THE COLLECTIONS
IMPORTING A JSON FILE VIEWING AND
TO MONGODB COMPASS MANAGING DATA
•Open the desired collection.
•Click the "Add Data" button in the top- •View Documents:
•Select a collection to see all documents.
right corner.
•Select "Import File" from the dropdown •Use the filter bar to query data.
•Edit Documents:
menu.
•In the file dialog box: •Click the pencil icon to modify a document.
•Choose your JSON file. •Save changes to update.
•Ensure the File Type is set to JSON. •Delete Documents:
•Click "Import" to load the data into the •Click the trash icon to remove a document.
collection.
ENTITY:
CUSTOMER,
SCHEMA
• Key Features:
• Embedded
documents for
addresses and
purchase history.
• Easily query for
purchase patterns.
ENTITY:
PRODUCTS,
SCHEMA
• Key Features:
• Product inventory
management.
• Embeds supplier contact
information.
• Easy to filter products by
category or stock levels.
NTITY: EMPLOYEE,
SCHEMA
• Key Features:
• Manages
information and
roles.
• Performance data
for analytics and
reviews.
QUERYING DATA
Filter Documents : Sort Results:
•Use the "Sort" bar.
• Use the "Filter" bar and input •Example: Sort by price
queries in JSON format.
descending
• Example: Find products with { "price": -2 }
stock quantity greater than 50:
{ "Stock Quantity": { $gt: 50
}}
CHALLENGES AND
SOLUTIONS
• Challenge: Large datasets can lead to
• Challenge: MongoDB is schema-less, which
allows flexibility but can lead to inconsistent slow queries if indexes are not optimized.
data if not planned carefully.
• Solution:
• Solution: • Use indexes effectively, including
• Use a schema design tool (e.g., compound, unique, and text indexes.
VSCode) to enforce schema rules. • Analyze query performance with
• Challenge: Unlike relational databases, MongoDB Compass
MongoDB does not support JOINs, making • Challenge: Adopting MongoDB requires
complex relationships harder to manage.
adapting to its NoSQL mindset.
• Solution:
• Solution:
• Use embedded documents for one-
to-many or one-to-one relationships. • Leverage MongoDB’s official
documentation, courses, and
• Reference data using ObjectIDs for community resources.
many-to-many relationships and
manage joins in the application layer. • Start with small, non-critical
projects to build expertise.
CONCLUSION
MongoDB offers a flexible, scalable, and high-performance solution
for modern database creation, especially for applications dealing
with large amounts of unstructured or semi-structured data. While its
schema-less nature and lack of native support for complex
relationships present challenges, these can be mitigated with
thoughtful schema design, effective indexing, and the use of tools
like Mongoose and MongoDB Compass. By leveraging MongoDB’s
powerful features such as sharding, data validation, and built-in
scalability, developers can build robust, efficient databases that
grow with their applications. With the right strategies in place,
MongoDB can be an excellent choice for a wide range of use cases.

You might also like