docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
Defines decorated classes for a product catalog and produces both a runtime schema and a raw definition that align with MongoDB via the dependency's class-to-schema utilities.
name and required number path for price, and applies default value 0 for inventoryCount when saving a product missing that field. @testcategory as nested object with required title and slug, persists tags as an array of strings, and treats dimensions as optional nested object with numeric width and height fields. @testfullTitle that returns "<name> - <category.title>" and appears in JSON output when virtuals are enabled, while remaining non-persisted. @testname/price, string tags array, nested category, optional dimensions, defaulted inventoryCount) so async model registration can reuse it without re-describing fields. @testexport class Dimensions {
width: number;
height: number;
}
export class Category {
title: string;
slug: string;
}
export class Product {
name: string;
price: number;
tags: string[];
category: Category;
dimensions?: Dimensions;
inventoryCount?: number;
fullTitle: string;
}
export function buildProductSchema(): import('mongoose').Schema;
export function buildProductDefinition(): Record<string, any>;Provides decorators and factory helpers to turn decorated classes into schemas and raw definitions compatible with NestJS and Mongoose.