CRUD in MongoDB Compass

                            CRUD IN MONGODB COMPASS


Introduction : - 

MongoDB Compass is the official graphical user interface (GUI) for MongoDB, making it easy for beginners and developers to visualize and manage their data. In this guide, we’ll walk through how to perform CRUD (Create, Read, Update, Delete) operations using MongoDB Compass — no code required!


CRUD stands for:

  • C – Create (Add new data)

  • R – Read (View or search data)

  • U – Update (Modify existing data)

  • D – Delete (Remove data)


Step 1: Connect to MongoDB in Compass 

1.Open MongoDB Compass.

2.Click Connect.




Step 2: Create a New Database and Collection

1.Click on “+ Create Database” (top-left).

3.Enter a Database Name (e.g., Name).

3.Enter a Collection Name (e.g., age).

4.Click Create Database.


CRUD Operations in MongoDB Compass



1. CREATE – Insert Documents

1.Go to your collection (school → students).

2.Click on “Insert Document”.

3.A JSON editor appears.

4.Click Insert. The document is now saved!




 
                                                                                                                                                          
2. READ – View and Filter Documents

  • Simply open your collection. All documents will be displayed.

Filter/Search:

  • Use the “Filter” bar at the top.

  • Example: Find students name in database.


3. UPDATE – Modify Documents

To update a document:
  1. Hover over the document you want to update.

  2. Click the pencil/edit icon (🖉).

  3. Edit fields directly in the JSON:

    • Change "age": 21 to "age": 34.

  4. Click Update.




4. DELETE – Remove Documents

To delete a document:

  1. Find the document you want to delete.

  2. Click the trash bin icon on the right side.

  3. Confirm deletion.






Create a new student entry.

Read student details using filters (like by course or age).

Update their course or marks.

Delete students who have graduated.

Conclusion -

MongoDB Compass makes database operations visual and intuitive. Whether you're a beginner learning MongoDB or a developer managing live data, understanding how to perform CRUD operations through Compass is a must-have skill.



Biradar Abhijeet Janardhan (BCA2302207)
University: Sri Balaji University, Pune
School: School of Computer Studies
Course: BCA (Bachelor of Computer Applications)
Interests: NoSQL, MongoDB, and related technologies

📸 Instagram 🔗 LinkedIn 🌐 Official Website




Comments

Post a Comment

Popular posts from this blog

MongoDB Master Guide

Covered Queries and Index Queries in MongoDB