Performing CRUD operations in MongoDB

MongoDB is one of the popular NoSQL databases. You need to create a MongoDB database and collection and you can do basic CRUD using the Azure Terminal in the browser, or get a connection string and connect it to your node app.

  1. Open your Azure portal and create a new MongoDB instance; refer to the following screenshot for reference:
  1. Once it is created, you can add a new collection to it. Refer to the following screenshot for reference:
  1. Now you need to retrieve a connection string. Go to the Settings | Connection String option and copy the connection string.
Keep it somewhere secure and do not share it.

Now you can connect your Node.js application to this MongoDB instance using the connection string.

We are going to cover Node.js in Chapter 5, Integrating Node.js with Cosmos DB.

You can, however, do the CRUD on the Azure browser terminal itself.

  1. Click on the New document button on top of the bar and add the following JSON to create a document:
{ 
    "id": "10", 
    "name": "Shahid", 
    "location": "Mumbai", 
    "job": "Engineer" 
} 
  1. Once a document is created, you can view it using the query, or by clicking on the left bar which contains lists of documents. You can delete it by clicking on that small cross button.

We will cover doing the CRUD using code in the next chapter.

Let's see how to do crud operations in Graph DB.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.119.136