Skip to content

Instantly share code, notes, and snippets.

View powertech2nd's full-sized avatar

Wibisono Indrawan powertech2nd

View GitHub Profile

07 — Quick Rules of Thumb

The golden rules for deciding how to structure your MongoDB data.


The Big Decision: Embed vs. Reference

Every time you have related data, ask yourself one question:

06 — The "Assembly Line" (Complex Aggregation)

Goal: Chain multiple operations together — filter, join, calculate — in a single query. Key Idea: The Aggregation Pipeline is a series of stages. Each stage transforms the data and passes it to the next.


The Pipeline Mental Model

05 — Relationships & Joins ($lookup)

Goal: Combine data from two separate collections. Key Idea: MongoDB's equivalent of LEFT OUTER JOIN is the $lookup stage inside an Aggregation Pipeline.


How Results Differ

| | SQL JOIN | MongoDB $lookup |

04 — The NoSQL Superpower: Arrays

Goal: Query data that lives inside a list (array) within a document. Key Idea: MongoDB searches inside arrays automatically — no extra joins needed.


The Problem in SQL

In a relational database, storing multiple tags for a post requires three tables and a join:

03 — Projections (Selecting Specific Columns)

Goal: Return only the fields you need, not the entire document. Key Idea: In MongoDB, .find() takes two arguments — the filter, then the projection.


The Two-Argument Pattern

02 — Conditional Queries (Find Many)

Goal: Filter results based on status or numerical ranges. Key Idea: MongoDB uses Operators (words starting with $) instead of math symbols.


The Core Difference

| SQL | MongoDB Operator | Meaning |

01 — Finding Data (The Basics)

Goal: Look up a single specific record, like a user by their email.


Concept Comparison

Feature SQL MongoDB
@powertech2nd
powertech2nd / nosql-0.md
Last active March 5, 2026 11:53
NoSQL tutorial

📊 SQL vs. MongoDB: The Ultimate Cheat Sheet

This guide translates common SQL operations into MongoDB (NoSQL) syntax, highlighting the shift from tables and rows to collections and documents.


📁 Sections

File Topic
@powertech2nd
powertech2nd / gist:2435b3bd91e7a5848548cb3625eed608
Last active March 2, 2026 14:15
Running multiple PHP on XAMPP windows

Run Multiple PHP Versions in a Single XAMPP Installation (Windows)

With a single XAMPP installation, you have 3 options to run multiple PHP versions:


✅ Option 1 — Run an Older PHP Version for Specific Directories

This is the most common use case.