DEV Community

Mahir-Ahsef
Mahir-Ahsef

Posted on

CRUD Operations

Answer: CRUD operations are the mix of Create, Read, Update and Delete.

Create: The Create operation is used to populate the MongoDB database with new documents.

There is two way to create documentations in a collections:
db.Userscollection.insertOne()
db.Userscollection.insertMany()

Read: The read operation is used to query a database document.

There is two way to read documentations in a collections:
db.Userscollection.findOne()
db.Userscollections.find()

Update: The Update operation is used to make changes to existing database documents.

To update documents in a collection, MongoDB supports the following methods:
db.Userscollection.updateOne()
db.Userscollection.updateMany()
db.Userscollection.replaceOne()
Delete: To delete documents from the database, utilize the Delete operation.

To delete documents from a collection, MongoDB supports the following methods:
db.Userscollection.deleteOne()
db.Userscollection.deleteMany()

Top comments (0)