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

Writeups - Assignment 9

The document discusses MongoDB and its CRUD operations for creating, reading, updating, and deleting documents. It provides descriptions of MongoDB methods like insertOne, insertMany, find, updateOne, updateMany, replaceOne, deleteOne, and deleteMany.

Uploaded by

ganesh bagul
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Writeups - Assignment 9

The document discusses MongoDB and its CRUD operations for creating, reading, updating, and deleting documents. It provides descriptions of MongoDB methods like insertOne, insertMany, find, updateOne, updateMany, replaceOne, deleteOne, and deleteMany.

Uploaded by

ganesh bagul
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment 9

Title: Design and Develop MongoDB Queries using CRUD operations. (Use CRUD operations,
SAVE method, logical operators etc.).

Theory:

MongoDB, the most popular NoSQL database, is an open-source document-oriented database.


The term ‘NoSQL’ means ‘non-relational’. It means that MongoDB isn’t based on the table-like
relational database structure but provides an altogether different mechanism for storage and
retrieval of data. This format of storage is called BSON ( similar to JSON format).

SQL databases store data in tabular format. This data is stored in a predefined data model which
is not very much flexible for today’s real-world highly growing applications. Modern
applications are more networked, social and interactive than ever. Applications are storing
more and more data and are accessing it at higher rates.

Relational Database Management System(RDBMS) is not the correct choice when it comes to
handling big data by the virtue of their design since they are not horizontally scalable. If the
database runs on a single server, then it will reach a scaling limit. NoSQL databases are more
scalable and provide superior performance. MongoDB is such a NoSQL database that scales by
adding more and more servers and increases productivity with its flexible document model.

MongoDB is used for various things like building an application (including web and mobile), or
analysis of data, or an administrator of a MongoDB database, in all these cases we need to
interact with the MongoDB server to perform certain operations like entering new data into the
application, updating data into the application, deleting data from the application, and reading the
data of the application. MongoDB provides a set of some basic but most essential operations that
will help you to easily interact with the MongoDB server and these operations are known
as CRUD operations.

Create Operations
The create or insert operations are used to insert or add new documents in the collection. If a
collection does not exist, then it will create a new collection in the database. You can perform,
create operations using the following methods provided by the MongoDB:

Method Description

db.collection.insertOne() It is used to insert a single document in the collection.

db.collection.insertMany()It is used to insert multiple documents in the collection.

db.createCollection() It is used to create an empty collection.

Read Operations

The Read operations are used to retrieve documents from the collection, or in other words, read
operations are used to query a collection for a document. You can perform read operation using
the following method provided by the MongoDB:

Method Description

db.collection.find()It is used to retrieve documents from the collection.

Update Operations

The update operations are used to update or modify the existing document in the collection. You
can perform update operations using the following methods provided by the MongoDB:

Method Description

It is used to update a single document in the collection that satisfy


db.collection.updateOne() the given criteria.

It is used to update multiple documents in the collection that satisfy


db.collection.updateMany() the given criteria.

It is used to replace single document in the collection that satisfy


db.collection.replaceOne() the given criteria.
Delete Operations

The delete operation are used to delete or remove the documents from a collection. You can
perform delete operations using the following methods provided by the MongoDB:

Method Description

It is used to delete a single document from the collection that satisfy


db.collection.deleteOne() the given criteria.

It is used to delete multiple documents from the collection that


db.collection.deleteMany() satisfy the given criteria.

Conclusion: Thus we have designed and developed MongoDB queries using CRUD operations.

You might also like