0% found this document useful (0 votes)
21 views14 pages

Mongo DB

MongoDB is a cross-platform, document-oriented database known for its high performance, availability, and scalability, utilizing collections and documents instead of traditional tables. It offers advantages over RDBMS such as schema-less design, ease of scaling, and dynamic queries. The document outlines installation steps for MongoDB on Ubuntu and basic commands for creating and managing databases.
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)
21 views14 pages

Mongo DB

MongoDB is a cross-platform, document-oriented database known for its high performance, availability, and scalability, utilizing collections and documents instead of traditional tables. It offers advantages over RDBMS such as schema-less design, ease of scaling, and dynamic queries. The document outlines installation steps for MongoDB on Ubuntu and basic commands for creating and managing databases.
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/ 14

PRODUCT SUMMARYWITH MONGODB

GETTING STARTED
UPDATE ON THE PLAN AND PROGRESS
UNIT 1 : MONGODB
MONGODB – OVERVIEW

 MongoDB is a cross-platform, document oriented database that


provides, high performance, high availability, and easy scalability.
MongoDB works on concept of collection and document.
MONGODB – OVERVIEW

Database Collection
 Database is a physical container for  Collection is a group of MongoDB
collections. Each database gets its own documents. It is the equivalent of an
set of files on the file system. A single RDBMS table. A collection exists within a
MongoDB server typically has multiple single database. Collections do not
databases. enforce a schema. Documents within a
collection can have different fields.
Typically, all documents in a collection
are of similar or related purpose.
MONGODB – OVERVIEW
RDBMS MongoDB
Database Database
Table Collection
Document
 A document is a set of key-value pairs.
Tuple/Row Document Documents have dynamic schema. Dynamic
column Field
schema means that documents in the same
collection do not need to have the same set of
Embedded fields or structure, and common fields in a
Table Join
Documents collection's documents may hold different types
Primary Key of data.
(Default key
Primary Key _id provided by
MongoDB
itself)
ADVANTAGES OF MONGODB OVER RDBMS

• Schema less − MongoDB is a document database in which one collection holds different documents.
Number of fields, content and size of the document can differ from one document to another.
• Structure of a single object is clear.
• No complex joins.
• Deep query-ability. MongoDB supports dynamic queries on documents using a document-based query
language that's nearly as powerful as SQL.
• Tuning.
• Ease of scale-out − MongoDB is easy to scale.
• Conversion/mapping of application objects to database objects not needed.
• Uses internal memory for storing the (windowed) working set, enabling faster access of data.
 Document Oriented Storage − Data is stored in
the form of JSON style documents.

 Index on any attribute

 Replication and high availability


WHY USE
MONGODB?  Auto-Sharding

 Rich queries

 Fast in-place updates

 Professional support by MongoDB


• Big Data
• Content Management and Delivery
WHERE TO USE
• Mobile and Social Infrastructure
MONGODB?
• User Data Management
• Data Hub
 1.Import the public key used by the
package management system.
From a terminal, issue the following
command to import the MongoDB public GPG
Key from
INSTALL https://www.mongodb.org/static/pgp/server-4.4.as
MONGODB ON c
:
UBUNTU wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc |
sudo apt-key add -
Create the list file /etc/apt/sources.list.d/mongodb-org-4.4.list for your version of Ubuntu.

 2.Create a list file for


MongoDB.
 Create the list
file /etc/apt/sources.list.d/mongodb-org-
4.4.list for your version of Ubuntu.
INSTALL for Ubuntu 18
MONGODB ON
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu
UBUNTU bionic/mongodb-org/4.4 multiverse" | sudo tee
/etc/apt/sources.list.d/mongodb-org-4.4.list

for Ubuntu 20

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu


focal/mongodb-org/4.4 multiverse" | sudo tee
/etc/apt/sources.list.d/mongodb-org-4.4.list
 3.Reload local package database.

Issue the following command to reload the local


package database:
INSTALL
MONGODB ON
UBUNTU sudo apt-get update
 4.Install the MongoDB packages.

You can install either the latest stable version of


MongoDB or a specific version of MongoDB
INSTALL
MONGODB ON
sudo apt-get install -y mongodb-org
UBUNTU echo "mongodb-org hold" | sudo dpkg --set-selections
echo "mongodb-org-server hold" | sudo dpkg --set-
selections
echo "mongodb-org-shell hold" | sudo dpkg --set-
selections
echo "mongodb-org-mongos hold" | sudo dpkg --set-
selections
echo "mongodb-org-tools hold" | sudo dpkg --set-
selections
CREATE DATABASE

 MongoDB use DATABASE_NAME is used to create database. The command will create a new
database if it doesn't exist, otherwise it will return the existing database.
 Syntax
 Basic syntax of use DATABASE statement is as follows −

use DATABASE_NAME
CREATE DATABASE

 To check your currently selected database, use the command db.

>db
mydb

 If you want to check your databases list, use the command show dbs.

>show dbs
local 0.78125GB
test 0.23012GB
THE DROPDATABASE() METHOD

 MongoDB db.dropDatabase() command is used to drop a existing database.


 Syntax
 Basic syntax of dropDatabase() command is as follows −

>show dbs
local 0.78125GB
mydb 0.23012GB
test 0.23012GB
>use mydb
switched to db mydb
>db.dropDatabase()
>{ "dropped" : "mydb", "ok" : 1 } >

You might also like