• It is used for various things like building an application (including web and mobile), or analysis of data, or administrator of a MongoDB database.
  • Those things interact with the MongoDB server to perform certain operations like creating data into the application, reading the data of the application, updating data into the application, and deleting data from application.
  • This database provides some operations and easily interacts with the server. Hence, this is known as CRUD operations.

Create Operations:

  • This operation is used to insert or add new documents in collection.
  • It will create a new collection in the database If a collection does not exist.
  • In this operation, there are two types of methods provided by MongoDB:
    1. collection.insertOne()
    2. collection.insertMany()

Read Operations :

  • It is used to query a collection for a document and to retrieve documents from the collection, or in other words.
  • In this operation, there is single method provided by MongoDB:
    1. collection.find ()

Update Operations :

  • It is used to modify or update the existing document in the collection.
  • In this operation, there is three types of method provided by MongoDB:
    1. collection.updateOne()
    2. collection.updateMany()
    3. collection.replaceOne()

Delete Operations :

  • It is used to remove or delete the existing document in the collection.
  • In this operation, there are two types of method provided by MongoDB:
    • collection.deleteOne()
    • collection.deleteMany()

Categorized in: