0% found this document useful (0 votes)
38 views

NOSQL

Uploaded by

assinghas292
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

NOSQL

Uploaded by

assinghas292
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

PRESENTATION ON

MONGO_DB
2

AGENDA
Introduction to MongoDb
How to Download?
MongoDb Shell
MongoDb Campus
WHAT IS MONGO DB ?
MONGODB IS A POPULAR NOSQL DATABASE THAT STORES DATA
IN A FLEXIBLE, DOCUMENT-ORIENTED FORMAT. INSTEAD OF
USING TABLES AND ROWS LIKE TRADITIONAL SQL DATABASES,
MONGODB USES DOCUMENTS (SIMILAR TO JSON OBJECTS) AND
ORGANIZES THEM INTO COLLECTIONS. THIS MAKES MONGODB
HIGHLY SCALABLE AND IDEAL FOR HANDLING LARGE,
UNSTRUCTURED, OR SEMI-STRUCTURED DATASETS.
HOW TO DOWNLOAD
MONGODB IN WINDOWS!!
Step 1: Go to the
MongoDB Download Center to
download the MongoDB Community
Server.
Step 2: When the download is
complete open the msi file and
click the next button in the
startup screen:
Step 3: Now accept
the End-User License
Agreement and click the next
button:
Step 4: Now select
the complete option to
install all the program
features. Here, if you can
want to install only selected
program features and want
to select the location of the
installation, then use
the Custom option:
Step 5: Select “Run
service as Network
Service user” and copy
the path of the data
directory. Click Next:
Step 6: Click the Install
button to start the
MongoDB installation
process:
Step 7: After clicking on
the install button installation
of MongoDB begins:

Step 8: Now
click the Finish button to
complete the MongoDB
installation process:
Step 9: Now we go to the
location where MongoDB
installed in step 5 in your
system and copy
the bin path:
Step 10: Now, to create
an environment variable
open system properties
>> Environment
Variable >> System
variable >> path >>
Edit Environment
variable and paste the
copied link to your
environment system
and click Ok:
Step 11: After setting the
environment variable, we will run
the MongoDB server, i.e. mongod.
So, open the command Now, this time the MongoDB server(i.e.,
prompt and run the following mongod) will run successfully
command: mongod

Step 12: Now, Open C drive and


create a folder named “data”
inside this folder create another
folder named “db”. After creating
these folders. Again open the
command prompt and run the
following command: mongod
Step 13: Now we are going to
connect our server (mongod)
with the mongo shell. So, keep
that mongod window and open
a new command prompt window
and write mongo. Now, our
mongo shell will successfully
connect to the mongod.

Important Point: Please do


not close the mongod window if
you close this window your
server will stop working and it
will not able to connect with the
mongo shell.
MONGODB SHELL
MongoDB Shell is a Command Line Interface (CLI) that allows developers
to interact with MongoDB databases using commands. It's efficient for quick
operations, script execution, and database management tasks.

Key Features of MongoDB Shell:


• Command Line-Based: It operates in a terminal or command
prompt.
• Query Execution: You can run MongoDB queries directly from the
shell.
• Database Management: Create, modify, and delete databases,
collections, and documents.
• Scripting: You can automate database tasks using JavaScript.
• Direct Access: It allows direct interaction with the MongoDB server
for operations.
COMMON COMMANDS IN
MONGODB SHELL
1. Connecting to MongoDB: Type mongo to connect
to a running MongoDB instance.
2. Show Databases: show dbs
3. Create/Use a Database: use myDatabase
4. Insert a Document:
db.collectionName.insertOne({ key: "value" })
5. Query Documents: db.collectionName.find({ key:
"value" })
6. Update a Document:
db.collectionName.updateOne({ key: "value" }, { $set:
{ key: "newValue" } })
7. Delete a Document:
ADVANTAGES OF MONGODB
SHELL
• Lightweight: Minimal resources
needed to operate.
• Direct Interaction: Useful for
developers comfortable with the
command line.
• Automation: Scripts can be
written and executed for repetitive
EXAMPLE
tasks.

use testDBdb.students.insertOne({ name: "Bharat", age: 20,


course: "CSE" })db.students.find({ name: "Bharat" })
MONGO_DB COMPASS
MongoDB Compass is a Graphical User
Interface (GUI) tool that allows you to
visualize and interact with your MongoDB
database. It’s ideal for users who prefer
visual tools over command-line interaction.
KEY FEATURES OF MONGODB
COMPASS
• Visual Interface: Provides a user-friendly interface with menus and
visual components.
• Data Exploration: Allows you to browse and explore your
collections and documents.
• Query Builder: Helps to build queries without writing complex code.
• Schema Visualization: Displays the schema of documents,
showing data types and fields.
• Aggregation Pipeline Builder: Provides a visual way to build
aggregation pipelines.
• Index Management: Helps create and manage indexes visually.
• Performance Monitoring: Compass offers insights into database
performance, showing slow queries and resource usage.
COMMON OPERATIONS IN MONGODB
COMPASS
1.Connect to MongoDB:
•Open Compass and enter your MongoDB connection string (e.g., mongodb://localhost:27017).
2.View Databases and Collections:
•After connecting, databases and their collections are listed in the GUI.
3.Insert Documendocumentsts:
•Use the GUI to add to a collection by filling out fields.
4.Query Documents:
•Use the query builder to search for documents using filters.
5.Aggregation:
•Use the visual aggregation pipeline to transform and aggregate data.
6.Schema Exploration:
•View the structure of documents within a collection.
ADVANTAGES OF MONGODB
COMPASS

• User-Friendly: Easy to use for people who prefer graphical


interfaces.
• Schema Visualization: Offers insights into data structure and
relationships.
• Real-Time Monitoring: Provides performance insights for
optimization.
• Data Export/Import: Allows exporting and importing data through
the interface.
STEP-BY-STEP GUIDE:
MANUALLY INSERTING DATA
IN MONGODB VIA COMPASS
Step 1: Open MongoDB Compass
1. Launch MongoDB Compass from your system.
Step 2: Connect to MongoDB on localhost:27012
2.Enter the connection string:
• In the connection field, type: mongodb://localhost:270
• This tells Compass to connect to your MongoDB instance running on
localhost using port 27012.
2.Click on "Connect": MongoDB Compass will now connect to your
MongoDB instance.
Step 3: Create a New Database and Collection
1. Create a new database:
• After connecting, click on the "Create Database" button in the left
sidebar.
2. Create a new collection:
• After naming the database, specify a name for the collection (e.g.,
myCollection).
• Click Create to finish.
Step 4: Manually Insert Data
1. Select your database and collection:
• In the left sidebar, find the newly created database (e.g., myDatabase)
and expand it.
• Click on your collection (e.g., myCollection).
2. Insert a new document:
• Click on the "Insert Document" button at the top right of the
collection view.
3. Enter the document data:
• In the document editor, manually type in the data you want to insert.
Here's an example:
{ "name": "Bharat Khatwani", "age": 20, "field": "Computer
Click on "Insert":
After entering your data, click the "Insert" button to add the
document to your collection.
Step 5: View and Manage Data
View inserted documents:
After insertion, you’ll be able to see the document listed in the
collection view.
Update or delete documents:
You can also modify or delete documents by clicking on the
respective document and using the Edit or Delete options.
THANK
YOU

You might also like