DEV Community

aathith rhagav.b
aathith rhagav.b

Posted on

Hands-On MongoDB: Storing, Querying, and Analyzing Yelp Reviews

Introduction

MongoDB is a NoSQL database that allows flexible storage of JSON-like documents. In this hands-on session, I explored MongoDB by storing, querying, and analyzing a dataset of Yelp reviews. This blog demonstrates CRUD operations, queries, and data export.

Step 1: Setting Up MongoDB

Installed MongoDB locally and verified using mongosh.

Created a database called yelpDB and a collection reviews.

Step 2: Inserting Records
Inserting 20 Records

I inserted records using the MongoDB shell (mongosh) with insertMany():

Step 3: Queries
3.1 Top 5 Businesses by Average Rating


3.2 Count Reviews Containing "good"


3.3 All Reviews for Business B3


3.4 Update a Review


3.5 Delete a Record

Step 4: Export Query Results
Export Using Compass

Run the query → Click Export Query Results → Save as JSON/CSV.

Conclusion

This hands-on exercise helped me:

Understand MongoDB CRUD operations.

Practice aggregation and filtering queries.

Export query results for reporting or further analysis.

MongoDB’s flexible JSON-like storage and powerful querying make it an excellent choice for modern applications dealing with semi-structured data.

Top comments (0)