DEV Community

SM Toufiqul Hoque
SM Toufiqul Hoque

Posted on

CRUD Operation

CRUD Operation

Working with CRUD operations we have to work with a database. CRUD operations are often used with SQL and also No SQL, a topic we've covered in depth. Since SQL is so prevalent in the development community, people should understand how CRUD operations work.

Definition of CRUD

The acronym CRUD refers to the four basic functions of persistent storage, including create, read, update, and delete. Also, each letter in the acronym can refer to all functions executed in relational database applications and mapped to a standard HTML method, SQL statement and NoSQL statement or DDS operation

Explaining CRUD Operations

When we need to keep the track of customer data,account, payment information, health
Data, and other records require data storage hardware and applications that provide persistent storage.There are many types of databases: hierarchical databases, graph databases, and object-oriented databases to name a few. The most commonly implemented type of database is a relational database, which consists of data tabled in rows and columns and connected to other tables with complementary information by a system of keywords that includes primary keys and foreign keys.And we use another database which is NoSQL database.

Four CRUD Operations Components Explained (NoSQL)

There are four CRUD operation components :

Create Operations

Read Operations

Update Operations

Delete Operations

Create Operations
Add new documents to a collection. If the collection does not exist, insert operations will create the collection.
MongoDB provides the following methods to insert documents into a collection:
db.collection.insertOne() New in version 3.2
db.collection.insertMany() New in version 3.2
In MongoDB, insert operations target a single collection. All write operations in MongoDB are atomic on the level of a single document.

Read Operations
Read Operation read the documents from a collection:

In MongoDB, insert operations target a single collection. All write operations in MongoDB are atomic on the level of a single document.
Update Operations
In MongoDB, insert operations target a single collection. All write operations in MongoDB are atomic on the level of a single document.
In MongoDB, insert operations target a single collection. All write operations in MongoDB are atomic on the level of a single document.

db.collection.updateOne() New in version 3.2
db.collection.updateMany() New in version 3.2
db.collection.replaceOne() New in version 3.2

You can specify criteria, or filters, that identify the documents to update. These filters use the same syntax as read operations.

Delete Operations
Delete operations remove documents from a collection. MongoDB provides the following methods to delete documents of a collection:
db.collection.deleteOne() New in version 3.2
db.collection.deleteMany() New in version 3.2
In MongoDB, insert operations target a single collection. All write operations in MongoDB are atomic on the level of a single document.
You can specify criteria, or filters, that identify the documents to remove. These filters use the same syntax as read operations.

Oldest comments (0)