o1
@Mongobs
using Pyt
CRUD operation with MongoDB vsii
SAVE ITA02
What Is MongoDB?
MongoDB is a document database with the scalability
and flexibility that you want with the querying and in
dexing that you need
- MongoDB stores data in flexible, JSON-like documents, meaning fields can vary from
document to document and data structure can be changed over time
- The document model maps to the objects in your application code, making data
easy to work with
- Ad hoc queries, indexing, and real time aggregation provide powerful ways
to access and analyze your data
- MongoDB is a distributed database at its core, so high availability,
horizontal scaling, and geographic distribution are built in and easy to use
Need to run MongoDB?
High avellebity through built-in replication and faover Ea
Horizontal scelality with native sharding ,
sai “atone nncmanses
- Endtovendsecunty i Saeemis
- Native document validation and schema exploration ‘Tactreame) “Wy.
* woress: 4 €
with Compass eek HG
hey tn nga
- Management toting for automation, monitoring 7
and backup te
- Ful elastic database as a service with bultAn ,
best prctces
8
SAVE ITA03
How to perform CRUD operations
in MongoDB using Python.
To install pymongo we need to type the below command in the command prompt.
We will be using MongoDB compass, a GUI used to interact with data stored in MongoDB.
You can find the MongoDB compass installation here:
https://www.mongodb.com/docs/compass/master/install/
Choose which type of deployment is best for you
Download MongoDB Compass
SAVE ITA04
Firstly, we need to import the pymongo package and To connect to the MongoDB server,
we will use the MongoClient method.
Create Database
We can create a database using the below command.
Ce ea ee as)
CeCe omc)
SAVE ITA05
Inserting documents in the collection
SAVE ITA06
Retrieving the data from the collection
SAVE ITA07
Updating the documents in the collection
Updating the documents in the collection
{"Emp_ID": {"$eq"
rhe) collection,
SET Ma
tion.update_one(present_data, new_data)
Pre rc Meee Tee a1
Ste rel eee LS
eure Te Pm Ce)
SAVE ITA08
Deleting documents from the collectio
""“Deleting documents from the collection
{"Emp_ID": "JA20221
caterer (query)
(query)
SAVE ITA