Complete the code to import the Mongoose library.
const mongoose = require([1]);We import Mongoose by requiring the "mongoose" package.
Complete the code to define a new Mongoose schema.
const userSchema = new mongoose.[1]({ name: String, age: Number });We create a schema using mongoose.Schema.
Fix the error in the code to create a model from the schema.
const User = mongoose.model('User', [1]);
The model function expects the schema object, which is userSchema.
Fill both blanks to define a schema with a required string field and a number field.
const productSchema = new mongoose.[1]({ name: { type: String, [2]: true }, price: Number });
We use Schema to define the schema and required: true to make the field mandatory.
Fill all three blanks to create and export a Mongoose model named 'Order' with a schema having a date and total fields.
const orderSchema = new mongoose.[1]({ date: Date, total: Number }); const Order = mongoose.[2]('Order', [3]); module.exports = Order;
We define the schema with Schema, create the model with model, and pass the schema variable orderSchema.
