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

Mongo DB

MongoDB is an open-source NoSQL database written in C++ that offers flexible data models, indexing, and replication for scalable applications. It allows for the storage of unstructured data and provides a dynamic schema, enabling documents within a collection to have different structures. MongoDB is widely used for modern application development, supporting complex analytics and various functionalities, making it a preferred choice for developers.

Uploaded by

tannutiwari2341
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)
20 views18 pages

Mongo DB

MongoDB is an open-source NoSQL database written in C++ that offers flexible data models, indexing, and replication for scalable applications. It allows for the storage of unstructured data and provides a dynamic schema, enabling documents within a collection to have different structures. MongoDB is widely used for modern application development, supporting complex analytics and various functionalities, making it a preferred choice for developers.

Uploaded by

tannutiwari2341
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/ 18

MongoDB

MongoDB is an open source NOSQL dataset in C++, this offers flexible data models,
indexing, replication and modern applications for scalable architecture.

The MongoDB is an open-source document database and leading NoSQL database. MongoDB is written in C++.
This tutorial will give you great understanding on MongoDB concepts needed to create and deploy a highly
scalable and performance-oriented database.

MongoDB features are flexible data models that allows the storage of unstructured data. This provides full
support indexing, replication, capabilities and also user friendly APIs.

The MongoDB is a multipurpose dataset that is used for modern application development and cloud
environments. This scalable architecture enables us to handle system demands and also adding more nodes to
distribute the load.

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.
Collection

Collection is a group of MongoDB documents. It is the equivalent of an RDBMS table. A collection exists within
a single database. Collections do not enforce a schema. Documents within a collection can have different fields.
Typically, all documents in a collection are of similar or related purpose.

Document

A document is a set of key-value pairs. Documents have dynamic schema. Dynamic schema means that
documents in the same collection do not need to have the same set of fields or structure, and common fields in a
collection's documents may hold different types of data.
The following table shows the relationship of RDBMS terminology with MongoDB.
RDBMS MongoDB
Database Database
Table Collection
Tuple/Row Document
column Field
Table Join Embedded Documents
Primary Key (Default key _id provided by MongoDB itself)
Primary Key

Database Server and Client


mysqld/Oracle mongod
mysql/sqlplus mongo
Why to Learn MongoDB?

MongoDB can handle unstructured data, which provides better indexing and operations.
MongoDB ensures the development software applications that can handle all sorts of data
in a scalable way.
MongoDB is a rapid iterative development that enables the collaboration of a large
number of teams. MongoDB has become the most necessary database in the world, which
makes it easy for every developer to store, manage, and retrieve data.
MongoDB Applications

MongoDB is a NoSQL database. MongoDB provides following functionality to the


database programmers −
•Stores user data, comments and metadata
•MongoDB performs complex analytics queries and stores the behavioral data.
•This is used to manage chain data and optimize logistics.
•Environmental data and IoT devices are stored and analyzed.
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.
MongoDB Basic Commands
We have a list of standard MongoDb commands to interact with the database, These commands are CREATE,
READ, INSERT, UPDATE, DELETE, DROP and AGGREGATE can be classified into following groups based on
their nature −

Command Description
CREATE Creates a new table in the database and other objects in the database.
INSERT Inserts collection name in existing database.
DROP Deletes an entire table or specified objects in the database.
UPDATE Updates the document into a collection.
Data in MongoDB has a flexible schema.documents in the same collection. They do not need to
have the same set of fields or structure Common fields in a collections documents may hold
different types of data.

Data Model Design


MongoDB provides two types of data models: Embedded data model and Normalized data model.
Based on the requirement, you can use either of the models while preparing your document.

1. Embedded Data Model


2. Normalized Data Model
use MongoDB with Node.js,
Install required npm package:

Import and connect to MongoDB:


2. Create Database
MongoDB creates the database automatically when you insert the first document. The line:

3. Create Collection

4. Insert Document(s)
5. Delete Document(s)

6. Update Document(s)
7. Join Collections (Aggregation)
8. Sort

9. Query

You might also like