0% found this document useful (0 votes)
45 views13 pages

Mongo

Uploaded by

Instagram Reels
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)
45 views13 pages

Mongo

Uploaded by

Instagram Reels
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/ 13

MongoDB

CRUD OPERATIONS
NAME-GAURAV SINGH
BSC-IT 5 SEM
MongoDB
MongoDB is a powerful and flexible solution for
handling modern data needs. As a leading
NoSQL database, MongoDB offers a dynamic
schema design ,enabling developers to store and
manage data in a way that aligns seamlessly
with contemporary application requirements.
Unlike traditional relational databases,
MongoDB’s document-oriented architecture
allows for greater agility and scalability.
Difference between MongoDB and RDBMS?

MongoDB RDBMS

It IS A NON-RELATIONAL AND It IS A RELATIONAL DATABASE.


DOCUMENT ORIENTED DATABASE

IT IS SUITABLE FOR HIERARCHICAL IT IS NOT SUITABLE FOR


DATA STORAGE. HIERARCHICAL DATA STORAGE.

IT HAS A DYNAMIC SCHEMA. IT HAS A PREDEFINED SCHEMA.

IN TERMS OF PERFORMANCE, IT IS IT TERMS OF PERFORMANCE, IT IS


MUCH FASTER THAN RDBMS. SLOWER THAN MongoDB.
ADVANTAGES OF MongoDB
 It is a schema-less NoSQL database. You
need not to design the schema of the
database when you are working with
MongoDB.
 It does not support join operation.
 It provides great flexibility to the fields in the
documents.
 It contains heterogeneous data.
 It provides high performance, availability ,
scalability.
Change or Create a Database

You can change or create a new database by typing use then the
name of the database
Create Collection using mongosh

You can create a collection using


the createCollection() database method.
Insert Documents

insertOne()
To insert a single document, use the insertOne() method.

This method inserts a single object into the database.


insertMany()
 To insert multiple documents at once, use
the insertMany() method.
 This method inserts an array of objects into the database.
MongoDB mongosh Find

find()
To select data from a collection in MongoDB, we can use
the find() method.
This method accepts a query object. If left empty, all documents will be
returned.
MongoDB mongosh Update

updateOne()
The updateOne() method will update the first document that is found
matching the provided query.
updateMany()
The updateMany() method will update all documents
that match the provided query.
mongosh Delete

We can delete documents by using the


methods deleteOne() or deleteMany().
These methods accept a query object. The matching documents
will be deleted.
deleteMany()

The deleteMany() method will delete all documents that match the query
provided.

You might also like