title: How to write down nested schemas for mongoose using NestJS nomenclature
body: <p>I am learning NestJS, and Mongoose. I was wondering how to write down/code nested schemas in Mongoose using NextJS nomenclature.</p>
  <p>Incoming data structure looks like this -</p>
  <pre><code>{
      something: {
          info: {
              title: string,
              score: number,
              description: string,
              time: string,
              DateOfCreation: string
          },
          Store: {
              item: {
                  question: string,
                  options: {
                      item: {
                          answer: string,
                          description: string,
                          id: string,
                          key: string,
                          option: string
                      }
                  }
              }
          }
      }
  }
  </code></pre>
  <p><strong>Challenge: writing down that using NestJS internal APIs.</strong></p>
  <p>I am using NestJS and Mongoose. I want to write a schema for the data structure given above. <em><strong>I can't find examples for nested schemas</strong></em>.  Any insigth is welcome.</p>
  <p>I am a beginner in all NestJS, Mongoose and MongoDB. So please don't assume that I know something. Thus, any insight on Mongoose as well is welcome.</p>
  <p>Thanks a lot.</p>
  <p>Edit - Here's something I came up with after following this SO post - <a href="https://stackoverflow.com/questions/62704600/mongoose-subdocuments-in-nest-js">Mongoose Subdocuments in Nest.js</a> . But I am just throwing stones in the dark.</p>
  <pre><code>import { Prop, Schema, SchemaFactory } from &quot;@nestjs/mongoose&quot;;
  
  @Schema()
  export class Cat {
      @Prop()
      name: string
  }
  
  
  export const CatSchema = SchemaFactory.createForClass(Cat);
  
  
  @Schema()
  class testInfo {
      @Prop()
      title: string;
      @Prop()
      score: number;
      @Prop()
      description: string;
      @Prop()
      time: string;
      @Prop()
      DateOfCreation: string;
  }
  
  const testInfoSchema = SchemaFactory.createForClass(testInfo);
  
  @Schema()
  class OptionContent {
      @Prop()
      answer: string;
      @Prop()
      description: string;
      @Prop()
      id: string;
      @Prop()
      key: string;
      @Prop()
      option: string
  }
  const OptionContentSchema = SchemaFactory.createForClass(OptionContent);
  
  @Schema({ strict: false })
  class Option {
      @Prop({ type: OptionContentSchema })
      item: OptionContent;
  }
  
  const OptionSchema = SchemaFactory.createForClass(Option);
  
  @Schema({ strict: false })
  class Page {
      @Prop()
      question: string;
      @Prop({ type: OptionSchema })
      options: Option;
  }
  
  const PageSchema = SchemaFactory.createForClass(Page);
  
  @Schema({ strict: false })
  class McqStore {
      @Prop({ type: PageSchema })
      item: Page;
  }
  
  const McqStoreSchema = SchemaFactory.createForClass(McqStore);
  
  @Schema()
  export class Test {
      @Prop({ type: testInfoSchema })
      info: testInfo
  
      @Prop({ type: McqStoreSchema })
      McqStore: McqStore
  }
  
  const TestSchema = SchemaFactory.createForClass(Test);
  
  @Schema()
  export class TestContainer {
      @Prop({ type: TestSchema })
      name: Test
  }
  
  export const TestContainerSchema = SchemaFactory.createForClass(TestContainer);
  
  export type userDocument = TestContainer &amp; Document;
  </code></pre>