So there I was, innocently sipping chai ☕ when I thought: “Hey, let’s play around with MongoDB Atlas. How hard could it be?” Spoiler alert: it was part comedy, part tragedy, but in the end—success tasted sweeter than Gulab Jamun. 🍯
Step 1: Logging into MongoDB Atlas
MongoDB Atlas greeted me like a strict professor: “Welcome, young padawan. Ready to suffer with connection strings?”
I bravely clicked Create Cluster, gave it a free-tier hug, and promised not to blow up the cloud.
Step 2: Building the yelp_demo.reviews Collection
I created a database called yelp_demo and a collection named reviews. Then came the fun part—manually inserting 10 reviews. Imagine me, typing fake reviews like:
{
"business_id": "B003",
"review": "The biryani here is sooo good!",
"rating": 5,
"date": "2025-08-20"
}
Yes, I felt like an undercover Yelp critic.
Step 3: Query Magic 🪄
Top 5 businesses with highest average rating
Using the Aggregation Pipeline:
_db.reviews.aggregate([
{ $group: { _id: "$business_id", avgRating: { $avg: "$rating" } } },
{ $sort: { avgRating: -1 } },
{ $limit: 5 }
])
_
Translation: “Dear MongoDB, please rank these food joints before my stomach makes decisions for me.”
Count reviews containing “good”
But first, MongoDB whispered: “Thou shall create a text index.”
db.reviews.createIndex({ review: "text" })
db.reviews.countDocuments({ $text: { $search: "good" } })
Result: Apparently, everyone thinks food is “good.” My dataset looked like it was sponsored by the word “good.” 😂
Get all reviews for a specific business (B003)
db.reviews.find({ business_id: "B003" }).sort({ date: -1 })
Yup, sorted by date, because reviews age faster than bananas. 🍌
Update a review
_
db.reviews.updateOne(
{ business_id: "B003" },
{ $set: { review: "Actually, the biryani was legendary!" } }
)
_
Because sometimes, you realize you were too harsh.
Delete a record
db.reviews.deleteOne({ business_id: "B010" })
Farewell, random fake café. You shall not be missed.
Step 4: The Export Saga 🎭
I thought: “Cool, I’ll just click Export in Atlas!” But Atlas laughed in my face—no export button in browser!
So here’s the trick I used:
Switch to JSON view in Atlas, copy everything, paste into VS Code, save as .json.
If CSV was needed, I tossed the JSON into an online converter.
Not elegant, but hey—it worked! 🎉
The Moral of the Story 🧘
MongoDB Atlas is like a desi auntie at a wedding—confusing at first, but once you understand her, she’ll feed you endless data love. I inserted, queried, updated, deleted, and even counted “good” vibes, all while laughing at my own mistakes.
So, if you’re diving into #DataEngineering or #DataAnalysis, don’t be afraid to get your hands messy. MongoDB will test your patience, but trust me, the JSON rewards are worth it.
_
_#Hashtags:




Top comments (0)