The GUI For MongoDB - CRUD Functionalities


The MongoDB Compass is one of the best MongoDB Graphical User Interface tools in 2019. It is a desktop tool to analyze and understand our Database with ad hoc queries in seconds. It also has a cross-platform GUI to facilitate the modern front end for MongoDB. For more information, see MongoDB Compass.
MongoDB Compass 4.0
Now, let’s get started with the following steps.
Step 1 - Connect to MongoDB
First of all, we run the “mongod” at CMD to enable the MongoDB instance. It handles all MongoDB server tasks such as requests, responding to client, and memory management.

Now, open the MongoDB Compass which has the responsibility of user required access and favorite connections. When you opened the Compass, then it will ask you few authentication credentials for connecting localhost along with its port.
Here, I didn’t set any privileges to connect localhost while configuring Compass URI connection string so I’ll give the hostname and port only enough to enable my localhost (If automatically detected by URI).
  • Hostname – localhost (default hostname)
  • Port – 27017 (default port)
After doing the above instruction, click Connect.
Step 2 - Create a Database
Once connected to your MongoDB compass, you will navigate to the Compass Home. It manages all the database of the current connection.
  • Let’s create a new Database by clicking the “Create Database” button which is located at the top right side of the Compass Home. In the Create Database dialog, you can give the Database Name and follow by the Collection name for the first collection like “newDB” and “collection1” then click “CREATE DATABASE” button.
Step 3 - Create a Collection
From the Collection tab, click on the “CREATE COLLECTION” button to push up the Create collection dialog. Enter the Collection name and click “CREATE COLLECTION”.

Step 4 - Insert Document
Now, it is time to insert a document in our created collection by doing the below instructions.
  • Collection1>> INSERT DOCUMENT
In the Insert document dialog >> insert field and Value>> Data types.
Next, we want to add a new Field after the name, click plus icon (+) under the name and follow the above discussed instructions.
Now, we created several fields with corresponding values so click the “INSERT” button.
Step 5 - Delete operations
Drop document
From the Documents tab, click on a document that you want to delete. Then there will appear a small trash icon from the document tab >> Delete.
The selected document has been highlighted with red to indicate it's currently ready for deleting. Click on “DELETE” button.
Drop Collection
From the Collection tab, click on the trash icon. In the Drop Collection dialog, just give the exact collection name which needs to delete then click “DROP COLLECTION” button.
Drop Database
Click on the trash icon of the database >> Enter database name>> DROP DATABASE.
Step 6 - Update Document
Click on the pencil icon which is visible when you choose your document that needs to be modified.
Here, we have changed all values of the document that highlighted with yellow color. Click on the “UPDATE” button to achieve that.
Step 7 - Read document
Here, we will  find our specified field at the number of documents.
Click on the “Option” button at Line editor and give a filter query which field you need to search then hit the “FIND” button.

After finding our desired filter, we will get our exact find document.


I hope you understood about how to make MongoDB CRUD operations by using MongoDB compass with examples.

Recommended Ebook

Printing in C# Made Easy

Download Now!
Similar Articles