Professional Documents
Culture Documents
Mca - V20pca104 - Ec2332251010489
Mca - V20pca104 - Ec2332251010489
Mca - V20pca104 - Ec2332251010489
Procedure/Steps:
1. Create operation - Create operation or Insert operation are used to add new documents to the
collection and if the collection does not exist, it creates one. :- db.collection.insert()
2. Read opera on – This opera on reads the documents from the collec on. Thisprocess is taken
place by execu ng a query. :-–db.collec on. nd()
4. Delete opera on – Delete opera on erases the document from the collec on.:-
db.collec on.remove()
Program:
Create:
Create opera ons add new documents to a collec on. There are two ways to add new documents
to collec ons:
db.collec on.insertOne()
db.collection.insertMany()
ti
ti
ti
ti
ti
ti
ti
ti
ti
ti
ti
ti
ti
ti
ti
ti
ti
fi
ti
ti
ti
ti
ti
Read:
Read opera ons retrieve documents from a collec on. If thereis no collec on that currently exists,
it will automa cally createa new one.
Here is the method to retrieve informa on:
db.collec on. nd()
Update:
Update opera ons modify documents from a collec on.The three ways to add new documents to
collec ons are:
db.collec on.updateOne()
db.collection.updateMany()
db.collec on.replaceOne()
ti
ti
ti
ti
ti
fi
ti
ti
ti
ti
ti
ti
Delete:
Delete opera ons delete documents from a collec on. There are two ways to add new documents
to collec ons:
db.collec on.deleteOne()
db.collection.deleteMany()
RESULT/OUTPUT:
All Mongo CRUD Opera ons are successfully executed.
ti
ti
ti
ti
ti