DEV Community

CIBIN S
CIBIN S

Posted on

MongoDB Hands-On

Hello All,
I’ve been exploring how NoSQL databases work, and MongoDB was the perfect place to start.Its document-oriented structure makes it simple to model real-world data.Unlike relational databases, it doesn’t force a predefined schema, which means more flexibility.This article covers my step-by-step MongoDB practice project.

1. Setup

Installed MongoDB Compass locally for an easy GUI-based interaction.
Created a database named yelpDB and a collection named reviews.
Imported and manually added a dataset of sample Yelp-style business reviews.

2.Tasks Performed

  • Insert Records

I manually inserted at least 10 records into the reviews collection.
A pie chart showing 40% responded

3.Queries

  • Top 5 Businesses with Highest Average Rating

Using the aggregation pipeline with $group and $sort, I retrieved the top 5 businesses with the highest average ratings.

A pie chart showing 40% responded

  • Count Reviews Containing the Word “good”

To analyze sentiment, I searched for reviews that contained the word "good" using a regex query.

A pie chart showing 40% responded

  • Get All Reviews for a Specific Business ID

I queried for all reviews belonging to a specific business ID (e.g., B7 – Healthy Bites).

A pie chart showing 40% responded

  • Update a Review & Delete a Record

I performed both update and delete operations on the dataset:

A pie chart showing 40% responded
Updated a review to reflect an improved service.
Deleted one record flagged for removal.

Conclusion
This provided practical exposure to:

  • Managing data in MongoDB Compass.
  • Performing CRUD operations (Create, Read, Update, Delete).
  • Writing queries & aggregation pipelines.
  • Exporting data for reporting.

Overall, I learned how powerful MongoDB is for handling unstructured data and performing flexible queries without rigid schema constraints.

Top comments (0)