惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
U
Unit 42
N
Netflix TechBlog - Medium
人人都是产品经理
人人都是产品经理
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
小众软件
小众软件
V
Visual Studio Blog
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
博客园 - 叶小钗
GbyAI
GbyAI
爱范儿
爱范儿
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
D
DataBreaches.Net
博客园_首页
D
Docker
A
About on SuperTechFans
G
Google Developers Blog
I
InfoQ
T
The Blog of Author Tim Ferriss
V
V2EX
博客园 - Franky

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
MongoDB Query Practice Guide with Real Job Portal Dataset
Nasrullah Sh · 2026-05-12 · via DEV Community
Cover image for MongoDB Query Practice Guide with Real Job Portal Dataset

Nasrullah Sheikh Noman

Overview

Recently, I practiced MongoDB queries using a sample Job Portal database.

Instead of learning operators in isolation, I used a realistic Job Portal dataset to better understand how MongoDB queries work in real-world applications.


Dataset Structure

A sample jobs collection was created with fields such as:

  • title
  • company
  • location
  • salary
  • experience
  • skills
  • applicants
  • status
  • department

Example Document

{
  title: "\"Software Engineer\","
  company: "TechCorp Bangladesh",
  salary: 75000,
  skills: ["JavaScript", "Node.js", "MongoDB"]
}

Enter fullscreen mode Exit fullscreen mode


Topics Covered

1. Comparison Operators

Used for filtering documents based on value comparison.

Operators covered:

  • $eq
  • $ne
  • $gt
  • $gte
  • $lt
  • $lte

Example:

db.jobs.find({
  salary: { $gt: 70000 }
})

Enter fullscreen mode Exit fullscreen mode


2. Logical Operators

Combining multiple query conditions.

Operators covered:

  • $and
  • $or
  • $not
  • $nor

Example:

db.jobs.find({
  $or: [
    { location: "Dhaka" },
    { isRemote: true }
  ]
})

Enter fullscreen mode Exit fullscreen mode


3. Array Query Operators

Working with array fields such as skills.

Operators covered:

  • $in
  • $nin
  • $all
  • $size
  • $elemMatch

Example:

db.jobs.find({
  skills: { $all: ["Python", "SQL"] }
})

Enter fullscreen mode Exit fullscreen mode


4. Update Operators

Updating existing documents.

Operators covered:

  • $set
  • $inc
  • $push
  • $pull

Example:

db.jobs.updateOne(
  { title: "Frontend Developer" },
  { $push: { skills: "TypeScript" } }
)

Enter fullscreen mode Exit fullscreen mode


5. Projection, Sorting & Pagination

Topics covered:

  • Field selection
  • Sorting
  • Limiting results
  • Pagination

Example:

db.jobs.find({}, { title: 1, salary: 1, _id: 0 })
  .sort({ salary: -1 })
  .limit(5)

Enter fullscreen mode Exit fullscreen mode


6. Aggregation Pipeline

Used for analytics and reporting.

Operators covered:

  • $match
  • $group
  • $project
  • $sort

Example use case:

Calculate average salary by department.


7. Advanced Aggregation

Production-level query operations.

Operators covered:

  • $lookup
  • $unwind
  • $facet

Useful for:

  • Joining collections
  • Dashboard analytics
  • Multi-stage reporting

Key Learning

MongoDB becomes significantly easier to understand when practiced using realistic datasets instead of isolated examples.


Next Learning Goals

  • MongoDB Indexing
  • Mongoose ODM
  • MongoDB Atlas
  • Transactions

Thanks for reading.

mongodb #backend #nodejs #database #webdev