Skip to content

The Pit Stop Challenge

Professor Solo

Reading the manual is fine, but we don’t know the car until we’ve driven it. Get in the seat.


Challenge 1: The Standard Tune-Up (Maintenance)

Section titled “Challenge 1: The Standard Tune-Up (Maintenance)”

Scenario: We need a new collection for “Team Members.” Task: Define a Schema with a name (String), role (String), and isDriver (Boolean). Compile it into a Model named Member.

AI Prompt

Write a Mongoose schema for a ‘Member’ with name, role, and isDriver fields.


Scenario: We need to find all projects that are NOT active. Task: Write a getArchivedProjects function that returns all documents where isActive is false.

/*
Function: getArchivedProjects()
Returns: Array of projects where isActive is false
*/
AI Prompt

How do I filter a Mongoose query to find documents where a boolean field is false?


Scenario: A user wants to search for projects by slug, but they might type it in UPPERCASE using SPACES (e.g., “MY COOL APP”). Task: Write a function that takes a messy input string, converts it to a proper slug (lowercase, hyphens), and then searches the database for it.

AI Prompt

Write a JavaScript function to regex replace spaces with hyphens and convert to lowercase.


Tools down. Let’s document what we learned.