Challenge 2: Write a Mongoose Schema — Possible Solution ==================================================================== const mongoose = require("mongoose"); const taskSchema = new mongoose.Schema({ title: { type: String, required: true }, done: { type: Boolean, default: false } }); const Task = mongoose.model("Task", taskSchema); WHY THIS WORKS AS AN ANSWER ------------------------------ Each requirement from the challenge maps directly onto Mongoose's schema field options, the same pattern the chapter's own Product example used: - title: { type: String, required: true } makes title mandatory — attempting to create a Task without one would fail validation, the same enforcement idea as $jsonSchema's "required" array from Chapter 6, just expressed at the application layer instead of the database layer. - done: { type: Boolean, default: false } both constrains the field's type AND supplies a default value when none is given — creating a task without specifying "done" at all results in done: false automatically, a convenience the raw native driver doesn't provide on its own. mongoose.model("Task", taskSchema) then registers this schema as a usable model, the same way the chapter's example turned productSchema into a working Product model that could call .create().