title: Mongoose Subdocuments in Nest.js
body: <p>I'm moving my app from express.js to Nest.js, and I can't find a way to reference one mongoose Schema in another, without using old way of declaring Schema with mongoose.Schema({...}).</p>
  <p>Let's use example from docs, so I can clarify my problem:</p>
  <pre class="lang-js prettyprint-override"><code>@Schema()
    export class Cat extends Document {
    @Prop()
    name: string;
  }
  
  export const CatSchema = SchemaFactory.createForClass(Cat);
  </code></pre>
  <p>Now, what I want is something like this:</p>
  <pre class="lang-js prettyprint-override"><code>@Schema()
  export class Owner extends Document {
    @Prop({type: [Cat], required: true})
    cats: Cat[];
  }
  
  export const OwnerSchema = SchemaFactory.createForClass(Owner);
  </code></pre>
  <p>When I define schemas this way I'd get an error, something like this: <strong>Invalid schema configuration: <code>Cat</code> is not a valid
  type within the array <code>cats</code></strong></p>
  <p>So, what is the proper way for referencing one Schema inside another, using this more OO approach for defining Schemas?</p>