en
Feedback
Full Stack Camp

Full Stack Camp

Open in Telegram

Fullstack Camp | Learn. Build. Launch. Join us for a hands-on journey through HTML, CSS, JavaScript, React, Node.js, Express & MongoDB — all in one place. Use this bot to search for lessons. @FullstackCamp_assistant_bot DM: @Tarikey6

Show more
The country is not specifiedThe category is not specified
235
Subscribers
No data24 hours
-17 days
+330 days
Posts Archive
šŸš€ Week 8 Day 7 — Relationships, Advanced Querying & Optimization in MongoDB Hello campers! šŸ’™ Today’s lesson is where your backend becomes smarter, faster, and production-ready. We’re covering relationships, querying, performance, and aggregation — everything that turns a simple app into a real system. PART 1 — Relationships & Population āžØBig Idea In real applications, data is connected: āžUsers create posts āžOrders have products āžComments belong to posts MongoDB is NoSQL — it doesn’t enforce relationships like SQL does. But we can still link data using references and use populate() to fetch connected data. āž” Example Models User model
const userSchema = new mongoose.Schema({ name: String, email: String });
Post model
const postSchema = new mongoose.Schema({ title: String, content: String, author: { type: mongoose.Schema.Types.ObjectId, ref: "User" } });
āžØ Analogy Think of your database like a library: Users = library members Posts = books Each book has a borrower ID → reference to a user Without .populate() → you see only the user ID, not the user details. With .populate() → you automatically fetch the user info too. šŸ”¹ Using .populate()
const posts = await Post.find().populate("author"); console.log(posts);
Now each post includes author details, not just the ID. āž”Deep Population Sometimes, data is nested:
const commentSchema = new mongoose.Schema({ text: String, post: { type: mongoose.Schema.Types.ObjectId, ref: "Post" }, commenter: { type: mongoose.Schema.Types.ObjectId, ref: "User" } });
Fetch comments with post and user:
const comments = await Comment.find() .populate({ path: "post", populate: { path: "author" } }) .populate("commenter");
āž”Analogy
You’re fetching a book, the author of the book, and the person who reviewed it. Deep population = going 2–3 layers deep.
PART 2 — Querying & Pagination 1ļøāƒ£ Filtering & Query Params Example: // GET /api/posts?category=tech&author=123 const posts = await Post.find({ category: req.query.category, author: req.query.author }); āžØFilters = search options at an online store. You want only Electronics, price < $500, sorted by rating. 2ļøāƒ£ Pagination (limit + skip)
const page = parseInt(req.query.page) || 1; const limit = parseInt(req.query.limit) || 10; const posts = await Post.find() .skip((page - 1) * limit) .limit(limit);
You don’t load 1000 items at once — that’s slow.
āž” Text Search
await Post.createIndexes({ title: "text", content: "text" }); const results = await Post.find({ $text: { $search: "MongoDB" } });
PART 3 — Performance & Optimization 1ļøāƒ£ Indexing Indexing = table of contents for your database.
userSchema.index({ email: 1 });
āžMakes searches faster āžReduces full collection scans 2ļøāƒ£ Query Optimization Basics āžØOnly fetch fields you need → .select("name email") āžØUse lean queries → .lean() → returns plain JS objects, faster than Mongoose documents ā—ļøAvoid deep nested populates if not needed šŸ”¹ Lean Queries const users = await User.find().lean(); āžFaster for read-only operations āžLess memory overhead āž Instead of bringing a full encyclopedia, you just photocopy the needed page. PART 4 — Aggregation Framework Aggregation = MongoDB’s ā€œExcel for databasesā€ āž$match → filter documents āž$group → group & summarize āž$project → select/transform fields Example — Average post views by author
const result = await Post.aggregate([ { $match: { published: true } }, { $group:   { _id: "$author", avgViews: { $avg: "$views" } } }, { $project: { authorId: "$_id", avgViews: 1, _id: 0 } } ]);
Think of aggregation as preparing a report: āžØ$match → filter your raw data āžØ$group → summarize by category āžØ$project → format report columns Deep Aggregation Idea You can combine $lookup to simulate joins:
const posts = await Post.aggregate([ { $match: { published: true } }, { $lookup: { from: "users", localField: "author", foreignField: "_id", as: "authorDetails" }} ]);
āžLike merging two spreadsheets: posts + authors → single report.

Happy Easter Fam ā¤ā¤ May this easter bring you the changes you are looking for and fill your home with full happiness.

your progress?
Anonymous voting

šŸ’„ Week 8 Day 6 — Backend Integration Challenges Challenge 1 — Library Book API šŸŽÆ Goal  Build a well-structured Express + Mongoose API for managing library books. Requirements  āž Use folder structure:  models/  routes/  config/  āž Use .env for DB connection  āž Create a Book model with:  - title (required)  - author (required)  - isbn (unique, required)  - publishedYear (min 1900, max current year)  - genre (enum: fiction, nonfiction, sci-fi, biography)  - isAvailable (default true) API Endpoints  āž POST /api/books → create a book  āž GET /api/books → all books  āž GET /api/books/available → use static method to get only available books  āž GET /api/books/:id/details → use schema method to return "Title by Author (Year) – Available/Not" Challenge 2 — Event Management API šŸŽÆ Goal  Add logic + validation rules to an event system. Requirements  āž Event model:  - name (required)  - date (required, must be future)  - capacity (min 1)  - category (enum: conference, workshop, social)  - ticketPrice (min 0)  - isCanceled (default false) Tasks  āž Create API routes (POST, GET)  āž Add custom validator → date must be after current date  āž Create static methodgetUpcomingEvents() → returns events with date >= today and not canceled  āž Add route to use it  āž Add a route that updates all past events → set isCanceled = true Challenge 3 — Task Management System (Clean Architecture) šŸŽÆ Goal  Simulate a real backend with better organization + logic separation. Requirements  āž Separate:  - model  - routes  - db config  āž Use .env  āž Task model:  - title (required)  - description (required)  - priority (enum: low, medium, high)  - completed (default false)  - dueDate (required) Tasks  āž Create routes:  - POST create task  - GET all tasks  āž Add schema methodmarkCompleted() → sets completed = true and saves  āž Add static methodgetOverdueTasks() → tasks with dueDate < today and not completed  āž Create route to mark a task as completed (use schema method)  āž Create route to get overdue tasks (use static method) When you are done,  šŸ’„ Share your solutions,  šŸ’„ invite a friend,  and as always — šŸ’„ stay well, stay curious, and stay coding āœŒļø

šŸš€ Week 8 Day 6 — Backend Integration + Mongoose Deep Dive Good Evening campers šŸ”„šŸ’™ Today , let's continue from prevous and get deep into Backend integration in a structured way. 🌳 PART 1 — MongoDB + Express Big Idea āžExpress = handles requests (GET, POST…) āžMongoose = handles database Together = full backend API šŸ— Basic Setup Install:
npm install express mongoose dotenv
🧱 Project Structure Instead of one messy file: project/ │ ā”œā”€ā”€ models/ │             └── User.js │ ā”œā”€ā”€ routes/ │           └── userRoutes.js │ ā”œā”€ā”€ config/ │         └── db.js │ ā”œā”€ā”€ .env ā”œā”€ā”€ app.js Analogy Think of this like a company: models/ →  blueprint department routes/ →  customer service (API endpoints) config/ → system setup app.js →  main building šŸ”Œ Database Connection (config/db.js)
const mongoose = require("mongoose"); const connectDB = async () => { try { await mongoose.connect(process.env.MONGO_URI); console.log("DB Connected āœ…"); } catch (err) { console.log(err); process.exit(1); } }; module.exports = connectDB;
Environment Variables (.env)
MONGO_URI=mongodb://127.0.0.1:27017/myAppDB PORT=5000
Why .env? Never hardcode sensitive data.
.env = secret vault šŸ”’ Your code = public office
Use dotenv in app.js require("dotenv").config(); šŸš€ app.js (Main Server) const express = require("express"); const connectDB = require("./config/db"); const app = express(); connectDB(); app.use(express.json()); app.use("/api/users", require("./routes/userRoutes")); app.listen(process.env.PORT, () => console.log("Server running ") ); 🚪 Routes (routes/userRoutes.js)
const express = require("express"); const router = express.Router(); const User = require("../models/User"); // CREATE router.post("/", async (req, res) => { const user = await User.create(req.body); res.json(user); }); // READ router.get("/", async (req, res) => { const users = await User.find(); res.json(users); }); module.exports = router;
What Just Happened? User sends request → Express route → Mongoose → MongoDB → response back Like: Customer → cashier → warehouse → cashier → customer 🧬 PART 2 — Mongoose Deep Dive Now we upgrade our models from basic → powerful. šŸ— models/User.js
const mongoose = require("mongoose"); const userSchema = new mongoose.Schema({ name: String, age: Number }); module.exports = mongoose.model("User", userSchema);
Now let’s LEVEL THIS UP šŸ‘‡ 1ļøāƒ£ Schema Validation Required Fields
name: { type: String, required: true }
šŸ‘‰ Must be provided Min / Max
age: { type: Number, min: 18, max: 60 }
šŸ‘‰ Controls allowed range Enum (Limited Options)
role: { type: String, enum: ["user", "admin", "moderator"] }
šŸ‘‰ Only specific values allowed 2ļøāƒ£ Default Values
isActive: { type: Boolean, default: true }
šŸ‘‰ If not provided → automatically set 3ļøāƒ£ Custom Validators
email: { type: String, validate: { validator: function (v) { return v.includes("@"); }, message: "Invalid email" } }
4ļøāƒ£ Schema Methods Methods = functions tied to a document
userSchema.methods.sayHello = function () { return Hello, my name is ${this.name}; };
Usage const user = await User.findOne(); console.log(user.sayHello()); 5ļøāƒ£ Static Methods Statics = functions on the model itself
userSchema.statics.findAdults = function () { return this.find({ age: { $gte: 18 } }); };
Usage
const adults = await User.findAdults();
FULL ADVANCED MODEL EXAMPLE
const mongoose = require("mongoose"); const userSchema = new mongoose.Schema( { name: { type: String, required: true }, age: { type: Number, min: 18, max: 60 }, email: { type: String, validate: { validator: v => v.includes("@"), message: "Invalid email" } }, role: { type: String, enum: ["user", "admin"], default: "user" }, isActive: { type: Boolean, default: true } }); // Method userSchema.methods.greet = function () { return Hi, I am ${this.name}; }; // Static userSchema.statics.getActiveUsers = function () { return this.find({ isActive: true }); }; module.exports = mongoose.model("User", userSchema);

Repost from Edemy
Story time… Someone asked me a question that often comes up: feeling stuck, wondering if it’s even possible to catch up, or if learning all this makes sense. Sometimes it’s how others talk about their achievements: ā€œHow are they doing all this already?ā€ ā€œWhy does it feel easy for them but not for me?ā€ ā€œAm I too slow?ā€ Sometimes it’s how the tech world is described: ā€œIs this even for me?ā€ ā€œWhere do I even start?ā€ ā€œWhat if I never get it?ā€ And sometimes, it’s hearing someone call a technology or process ā€œhardā€ or ā€œadvanced,ā€ making it feel impossible. But everyone’s journey is different, just because it’s hard for one person doesn’t mean it will be for someone else. The truth is, everyone starts somewhere. Confused. Stuck. Googling everything. Breaking things and starting again. No one has it all figured out at first. They just keep going. Even now, people are still learning. The struggle doesn’t disappear, the level just changes. The biggest challenge most people face is themselves. That voice that says: ā€œYou’re behind.ā€ ā€œYou’re not good enough.ā€ ā€œYou won’t reach where they are.ā€ We compare. We doubt. We slow ourselves down. Learning to be kind to yourself matters more than you think. Because growth comes from consistency, not pressure. Take small steps. Keep moving. That’s literally how everyone you look up to got there. And at the end Ask yourself: is it better to sit and wonder what if, or to try the thing you think is impossible? Try it, you’ll be surprised how things start to make sense when you invest time, energy, and effort. @edemy251

šŸ’„ Week 8 Day 5 — Mongoose Challenges 🧩 Challenge 1 — User Manager (Basic CRUD App) šŸŽÆ Goal Build a simple user system using Mongoose. Requirements āž™Connect to MongoDB (local or Atlas) āž™Create a User schema with: name email age isActive Operations āž™Create at least 5 users āž™Get all users āž™Find users with age > 20 āž™Update one user’s age āž™Delete one user by email 🧩 Challenge 2 — Product Inventory System šŸŽÆ Goal Simulate a store backend. Requirements āž™Create: Product schema Fields: name price category inStock rating Operations āž™Insert at least 8 products āž™Find all Electronics products āž™Find products with price between 100–500 āž™Sort products by rating (descending) āž™Update all low-rated products (rating < 3) → set inStock = false āž™Delete one product by ID 🧩 Challenge 3 — Blog System (Relationships Thinking) šŸŽÆ Goal Simulate a simple blog backend. Requirements āž™Create: User model and  Post model Post fields: title content author (store user ID) views published Operations āž™Create 2 users āž™Create multiple posts linked to users āž™Find all posts by a specific user āž™Find posts with views > 100 āž™Update one post → set published = true āž™Delete one post When you are done, šŸ’„ Share your solutions , šŸ’„invite a friend,       and as always — šŸ’„stay well, stay curious, and stay coding āœŒļø

šŸ”“ 8ļøāƒ£ DELETE (Remove Data) Delete one
await User.deleteOne({ name: "Sara" });
Delete many
await User.deleteMany({ isActive: false });
Delete by ID
await User.findByIdAndDelete("id_here");
⚔ 9ļøāƒ£ Async/Await (VERY IMPORTANT) All database operations are asynchronous. Always use:
async function run() {   const users = await User.find();   console.log(users); } run();
Why? Database takes time → network + disk operations. Without async: Your code runs before data is ready. 🧱 Example Full Flow (Simple App)
const mongoose = require("mongoose"); mongoose.connect("mongodb://127.0.0.1:27017/testDB")   .then(() => console.log("Connected")); const userSchema = new mongoose.Schema({   name: String,   age: Number }); const User = mongoose.model("User", userSchema); async function run() {   await User.create({ name: "Sara", age: 22 });   const users = await User.find();   console.log(users); } run();
🧠 What Just Happened? āžØConnected to DB āžØDefined schema āžØCreated model āžØInserted data āžØRetrieved data That’s a real backend workflow.

šŸš€ Week 8 Day 5 — Connecting MongoDB with Node.js (Mongoose) Alright campers šŸ’™ Today our backend will finally talk to a real database. Up until now: our data lived in memory (temporary 😢) Or inside MongoDB tools (manual work) Today: our Node.js app becomes alive — it can store, read, update, and delete real data automatically. 🌳 BIG IDEA — Backend ↔ Database Connection Think of your system like this: āž›MongoDB = šŸ¬ Warehouse (stores data) āž›Node.js = šŸ‘Øā€šŸ’¼ Manager (handles logic) āž›Mongoose = šŸ“ž Phone line between them Without Mongoose: Your backend and database are like two people who can’t communicate. 🧱 Why Mongoose? You can use MongoDB directly… but it’s messy. Mongoose gives you: āž™Structure (schemas) āž™Validation āž™Cleaner queries āž™Better developer experience šŸ›  1ļøāƒ£ Install Mongoose Inside your project:
npm install mongoose
Done. Now your Node app can communicate with MongoDB. šŸ”Œ 2ļøāƒ£ Connect to MongoDB First, import mongoose:
const mongoose = require("mongoose");
Connect (Local MongoDB)
mongoose.connect("mongodb://127.0.0.1:27017/myAppDB")   .then(() => console.log("DB Connected āœ…"))   .catch(err => console.log(err));
Connect (Atlas Cloud)
mongoose.connect("mongodb+srv://username:password@cluster.mongodb.net/myAppDB")
🧠 What’s Happening? āžmongodb://... = database address āžmyAppDB = database name āž.connect() = opening connection āš ļø Important: Connection must happen before using models. 🧬 3ļøāƒ£ Schema — Designing the Shape of Data MongoDB is flexible… but Mongoose introduces structure. A Schema defines how your data should look. Example: User Schema
const userSchema = new mongoose.Schema({   name: String,   email: String,   age: Number,   isActive: Boolean });
āžØ Analogy Schema = blueprint of a building. Before building a house: āžYou define rooms āžYou define structure šŸ— 4ļøāƒ£ Model — The Working Tool A Model is created from a schema.
const User = mongoose.model("User", userSchema);
🧠 Analogy If Schema = blueprint Then Model = construction company using that blueprint. You don’t interact with schema directly. You use the model to: create read update delete data 🟢 5ļøāƒ£ CREATE (Insert Data) Create a new user
const user = new User({   name: "Sara",   email: "sara@mail.com",   age: 22,   isActive: true });
Save to database
await user.save();
Shortcut (recommended)
await User.create({   name: "John",   email: "john@mail.com",   age: 25,   isActive: true });
šŸ”µ 6ļøāƒ£ READ (Find Data) Get all users
const users = await User.find();
Find one user
const user = await User.findOne({ name: "Sara" });
Find by ID
const user = await User.findById("id_here");
With conditions
const users = await User.find({ age: { $gt: 20 } });
🟔 7ļøāƒ£ UPDATE (Modify Data) Update one
await User.updateOne(   { name: "Sara" },   { $set: { age: 23 } } );
Update many
await User.updateMany(   { isActive: true },   { $set: { isActive: false } } );
Find and update (very common)
const updatedUser = await User.findByIdAndUpdate(   "id_here",   { age: 30 },   { new: true } );
new: true → return updated version

Good news Campers šŸ¤— From now on you don't have to scroll back to get lessons or challenges, I already made you a telegram bot for that. Check it out here and give me feedbacks so that I can improve it. @FullstackCamp_assistant_bot

Eid Mubarak y'all Muslim frnds! šŸ¤—

🧭 Understanding Relationships In database design, we think about how data relates to other data. Three common patterns exist. 🟔 1ļøāƒ£ One-to-One Relationship One record relates to exactly one other record. Example: User → Profile User document:
{   "_id": "u1",   "name": "Sara" }
Profile document:
{   "userId": "u1",   "bio": "Backend developer",   "location": "Addis Ababa" }
One user has one profile. 🟠 2ļøāƒ£ One-to-Many Relationship One record relates to multiple records. Example: User → Posts User:
{   "_id": "u1",   "name": "Sara" }
Posts:
{   "title": "Post 1",   "authorId": "u1" }
{   "title": "Post 2",   "authorId": "u1" }
One user can write many posts. 🧠 Analogy Teacher → Students One teacher teaches many students. šŸ”“ 3ļøāƒ£ Many-to-Many Relationship Both sides can relate to many records. Example: Students ↔ Courses Student document:
{   "name": "Sara",   "courses": ["course1", "course2"] }
Course document:
{   "title": "Databases",   "students": ["student1", "student2"] }
Multiple students join multiple courses. 🧠 Analogy Think of a gym membership system. Members join many classes. Classes contain many members. 🧠 How Engineers Decide (Important Thinking) When designing schema, engineers ask: 1ļøāƒ£ Do we always access this data together? → Embed 2ļøāƒ£ Is this data shared across many documents? → Reference 3ļøāƒ£ Can the data grow very large? → Reference 4ļøāƒ£ Is the relationship simple and small? → Embed There is no single perfect rule — it's about balancing performance and clarity. šŸ— Example Real Application Let's imagine a job platform like the one you built earlier. Users collection:
{   "_id": "user1",   "username": "Sara" }
Jobs collection:
{   "title": "Frontend Developer",   "company": "TechCorp",   "postedBy": "user1" }
Applications collection:
{   "jobId": "job10",   "userId": "user5" }
This structure keeps data clean and scalable. Next lesson we’ll move one step closer to real backend systems by connecting MongoDB to Node.js so our applications can actually use the database. Until then — stay well, stay curious, and stay coding āœŒļø

šŸš€ Week 8 Day 4 — Schema Design & Data Relationships in MongoDB Alright campers šŸ”„šŸ’™ Hope you're doing well and still showing up with curiosity and patience. Today we answer a very important design question: How should we structure our data? Because storing data is easy. Storing it the right way is what real engineers think about. 🌳 BIG IDEA — MongoDB Is Flexible, But Design Still Matters MongoDB is called schema-flexible. That means documents in the same collection do not need identical structure. Example: Document 1:
{   "name": "Sara",   "age": 22 }
Document 2:
{   "name": "John",   "email": "john@mail.com",   "hobbies": ["music", "sports"] }
MongoDB allows this. But here's the important truth: Just because you can store data randomly doesn't mean you should. Good schema design means: āžžData is easy to read āžžQueries are efficient āžžRelationships are clear āžžThe system scales well A good engineer plans the shelves before filling them. 🧱 Two Core Design Approaches in MongoDB MongoDB relationships are handled in two main ways: 1ļøāƒ£ Embedding documents 2ļøāƒ£ Referencing documents 🟢 1ļøāƒ£ Embedding Documents Embedding means placing related data inside the same document. Example: A blog post with its comments.
{   "title": "Learning MongoDB",   "author": "Sara",   "comments": [     {       "user": "John",       "message": "Great article!"     },     {       "user": "Liya",       "message": "Very helpful!"     }   ] }
Here, comments are embedded directly inside the post document. āœ… When Embedding Is Good: āžžData is closely related āžžData is accessed together āžžThe amount of nested data is small Examples: Blog post + comments User profile + address Order + purchased items āš ļø When Embedding Is Not Ideal: āž”The embedded data grows very large āž”Data must be accessed separately āž”Many documents reference the same data Example problem: If thousands of comments exist, embedding them all inside the post could make the document too large. šŸ”µ 2ļøāƒ£ Referencing Documents Referencing means storing related data in separate documents and linking them using IDs. Example: Blog posts referencing users. Users collection:
{   "_id": "user123",   "name": "Sara",   "email": "sara@mail.com" }
Posts collection:
{   "title": "Learning MongoDB",   "authorId": "user123" }
Here the post stores only the author's ID, not the full user data. āœ… When Referencing Is Good: āž”Data is shared across many documents āž”Data is large āž”Data changes frequently Examples: Users and posts Products and orders Students and courses

šŸ’„ Week 8 Day 3 — Query Operators Challenges 🧩 Challenge 1 — Advanced Product Filtering Create or use: storeDB → products Requirements āž”Insert enough products (if needed), then write queries to: āž™Find products with price between 300 and 1000 āž™Find products that are Electronics OR rating > 4.5 āž™Find products that have a discount field āž™Find products whose name contains "pro" (case-insensitive regex) āž™Find products that contain BOTH tags "gaming" and "portable" āž™Find products where specs.ram ≄ 16 🧩 Challenge 2 — Student Smart Search Use: schoolDB → students Requirements Write queries to: āž™Find students with GPA between 3.0 and 3.8 āž™Find students who are NOT graduated and age > 22 āž™Get distinct departments āž™Find students whose name starts with "A" (regex) āž™Find students where a scholarship field exists āž™Find students in Computer Science OR Software Engineering 🧩 Challenge 3 — Blog Post Deep Matching Use: blogDB → posts Requirements Write queries to: āž™Find posts with views > 200 AND published = true āž™Find posts where category is in a list of at least two categories āž™Find posts whose title contains "mongodb" (case-insensitive) āž™Find posts that have exactly 3 tags (use $size) āž™Find posts missing the featured field āž™Combine filters to get top high-view published tech posts When you are done, šŸ’„ Share your solutions , šŸ’„invite a friend, Ā Ā Ā Ā Ā  and as always — šŸ’„stay well, stay curious, and stay coding āœŒļø

🟠 5ļøāƒ£ Array Operators — Working with Lists Remember: tags: ["gaming", "portable"] Arrays are very common in MongoDB. Match Array Value
db.products.find({ tags: "gaming" })
MongoDB automatically checks inside arrays. āž”All Values — $all
db.products.find({   tags: { $all: ["gaming", "portable"] } })
-Must contain BOTH tags. āž”Array Size — $size
db.products.find({   tags: { $size: 2 } })
āž”Element Match — $elemMatch (important) For complex array objects. šŸ”µ 6ļøāƒ£ Nested Field Queries — Dot Notation Power MongoDB handles nested objects beautifully.
specs: {   ram: 16,   storage: 512 }
To query nested fields:
db.products.find({   "specs.ram": { $gte: 16 } })
This dot notation is VERY important. Think of it like: Opening boxes inside boxes. šŸ”“ 7ļøāƒ£ Regex Queries — Smart Text Search Regex = pattern matching. Used in: āž™search bars āž™autocomplete āž™keyword filtering
db.products.find({   name: { $regex: "lap" } })
Matches: āžžLaptop āžžLapdesk āžžLap…
{ $regex: "laptop", $options: "i" }
The "i" flag = ignore case. āš ļø Important: Regex is powerful but expensive. Use carefully in large datasets. 🧠 8ļøāƒ£ Query Composition Patterns Real power comes from combining operators.
db.products.find({   category: "Electronics",   price: { $gte: 500, $lte: 1500 },   rating: { $gt: 4 },   inStock: true })
This is how real production queries look. Think of queries like building a filter pipeline. Each condition narrows the results. More filters → more precision. šŸŽÆ After Today You Should Be Able To āœ… Use comparison operators confidently āœ… Combine conditions with logical operators āœ… Check field existence āœ… Query arrays correctly āœ… Query nested fields with dot notation āœ… Use regex for search āœ… Compose complex real-world queries

šŸš€ Week 8 Day 3 — Query Operators & Data Matching Morning campers šŸ”„šŸ’™ So far, you’ve been asking MongoDB simple questions like: ā€œGive me products in Electronics.ā€ Nice… but real apps ask MUCH smarter questions. Today you learn how to ask MongoDB: āž›very specific āž›very intelligent āž›very powerful questions. 🌳 BIG IDEA — Queries Are Questions Every MongoDB query is simply: ā€œFind documents that match these conditions.ā€ The magic comes from operators — special tools that help MongoDB filter precisely. Think of operators like search filters on an online store: āž›price range āž›category āž›rating āž›keyword search We’ll use this collection throughout: shopDB → products
{   name: "Gaming Laptop",   price: 1200,   category: "Electronics",   inStock: true,   rating: 4.5,   tags: ["gaming", "portable"],   specs: {     ram: 16,     storage: 512   } }
šŸ”µ 1ļøāƒ£ Comparison Operators — Value Matching These compare numbers or values. āž„Greater Than — $gt
db.products.find({ price: { $gt: 500 } })
āž„Greater Than or Equal — $gte { price: { $gte: 500 } } āž„Less Than — $lt { price: { $lt: 1000 } āž„Less Than or Equal — $lte āž„Not Equal — $ne { category: { $ne: "Furniture" } } āž„In List — $in
db.products.find({   category: { $in: ["Electronics", "Accessories"] } })
Like: Show items that belong to ANY of these shelves. Not In — $nin -Opposite of $in. 🟣 2ļøāƒ£ Logical Operators — Combining Conditions - AND , OR , NOT filters. āž”AND — $and
db.products.find({   $and: [     { price: { $gt: 500 } },     { inStock: true }   ] })
🧠 Pro tip: MongoDB often assumes AND automatically:
db.products.find({   price: { $gt: 500 },   inStock: true })
āž”OR — $or
db.products.find({   $or: [     { category: "Electronics" },     { rating: { $gt: 4.5 } }   ] })
āž”NOT — $not āž”NOR — $nor .... 🟢 3ļøāƒ£ Element Operators — Field Existence & Type Sometimes you don’t care about the value… You care whether the field exists. āž”Field Exists — $exists
db.products.find({   discount: { $exists: true } })
āž”Type Check — $type
db.products.find({   price: { $type: "number" } })
Used in: āž™data validation āž™migrations āž™debugging messy data 🟔 4ļøāƒ£ Evaluation Operators — Special Conditions āž™Regex — $regex (Preview) Used for pattern matching.
db.products.find({   name: { $regex: "laptop", $options: "i" } })
Meaning: āž™Find names containing ā€œlaptopā€ (case insensitive). This is like search bars in real apps. āž”Mod — $mod
db.products.find({   price: { $mod: [2, 0] } })

Repost from Edemy
To all the women reading this šŸ˜ Life isn’t always easy, and some days feel heavier than others. Yet, somehow, you keep moving. You keep dreaming. You keep building, even when the path isn’t clear. You carry so much responsibilities, hopes, and challenges, and still find a way to show up for yourself and others. That is strength. That is courage. That is resilience. It’s okay to take a pause. It’s okay to rest. Your worth isn’t measured by how much you do or how perfect your day looks. Every step, even the small ones, matters. To the women facing doubts, breaking barriers, and carving their own path, You are seen. You are strong. You are enough. šŸ’œ Happy Women’s Day šŸ’œ Keep shining, keep rising, and keep believing in the beautiful future you’re creating. @edemy251

Repost from DoughNut šŸ©
One thing I've learned about AI lately is that it will definetly replace software engineers, you might say which ones well software engineers who cant code, think, be creative, problem solve, think building a dashboard takes a week, think technical debt is an imaginary term. It honestly feels like having a really cool junior engineer u can tell it to do the boring stuff u dont wanna do while u focus on tough parts. But it doesnt mean u let it go all in without u knowing what to do. If you think a 20 bucks cursor subscription can build ur product end to end well you're a dumbass. But if u believe a 20 bucks subscription can help u move much faster while you are the senior architect welcome to the new era of software engineering.

šŸ’„ Week 8 Day 2 — Core Database Operations Challenges (Medium) Alright campers šŸ”„šŸ’™ Time to combine your CRUD powers. Use mongosh or Compass. 🧩 Challenge 1 — Store Inventory Create: storeDB → products āžžAdd at least 10 products using insertMany() āžžFields: name, price, category, inStock, rating āžžQuery Electronics only price > 300 rating < 3 āžžShow only name + price (projection) āžžSort by price (descending) āžžSkip 5 + limit 5 āžžIncrease price of Electronics āžžSet inStock = false for rating < 2 āžžDelete one product by name āžžDelete all out-of-stock products 🧩 Challenge 2 — Student Analyzer Create: schoolDB → students āž”Insert At least 12 students āž”Fields: name, age, department, gpa, graduated āž”Query gpa > 3.5 not graduated distinct departments āž”sort by gpa (desc) āž”show only name + gpa āž”Increase GPA for Computer Science students āž”Set graduated = true for gpa > 3.7 āž”Remove students with gpa < 2.0 🧩 Challenge 3 — Blog Bulk Operations Create: blogDB → posts āž”Insert At least 8 posts āž”Fields: title, author, views, category, published āž”BulkWrite (single command) āž›Insert 2 posts āž›Update views of one āž›Publish one draft āž›Delete one post āž›Query views > 100 āž›sort by views (desc) āž›top 3 posts When you are done, šŸ’„ Share your solutions , šŸ’„invite a friend,       and as always — šŸ’„stay well, stay curious, and stay coding āœŒļø