Complete the code to import the Schema decorator from Mongoose.
import { [1] } from '@nestjs/mongoose';
The @Schema decorator is imported from @nestjs/mongoose to define a Mongoose schema in NestJS.
Complete the code to define a schema class named User.
@[1]() export class User {}
The @Schema() decorator marks the class as a Mongoose schema in NestJS.
Fix the error in the property decorator to define a schema property.
import { Prop } from '@nestjs/mongoose'; @Schema() export class Product { @[1]() name: string; }
The @Prop() decorator defines a property in the Mongoose schema.
Fill both blanks to create a schema factory for the User class.
export const UserSchema = [1](User, [2]);
SchemaFactory.createForClass(User, { timestamps: true }) creates a Mongoose schema with timestamps enabled.
Fill all three blanks to define a schema with a required string property 'title'.
@Schema() export class Book { @[1]({ required: [2] }) [3]: string; }
The @Prop({ required: true }) decorator marks the 'title' property as required in the schema.