title: How to populate Nestjs mongoose schema records
body: <p>I want to get then enteries from paris air quality, but the thing is that the mongoose schema is nested and I tried to make multiple schemas separated but I don't know wheter it's correct or not.</p>
  <p>This is the schema file <code>schemas/air-quality.schema.ts</code></p>
  <pre class="lang-js prettyprint-override"><code>import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
  import { Document } from 'mongoose';
  
  export type AirQualityDocument = AirQuality &amp; Document;
  
  @Schema()
  export class Pollution {
    @Prop()
    ts: string;
  
    @Prop()
    aqius: number;
  
    @Prop()
    mainus: string;
  
    @Prop()
    aqicn: number;
  
    @Prop()
    maincn: string;
  }
  
  @Schema()
  export class Result {
    @Prop({ type: Pollution })
    pollution: Pollution;
  }
  
  @Schema()
  export class AirQuality {
    @Prop({ type: Result })
    result: Result;
  
    @Prop()
    datetime: string;
  }
  
  export const AirQualitySchema = SchemaFactory.createForClass(AirQuality);
  
  </code></pre>
  <p>And the result I am getting from mongo is this
  PS: it contains multiple entries of the same schema</p>
  <pre><code>[
      {
          &quot;_id&quot;: &quot;62dd1b2e744e6bf8cdbcfabd&quot;,
          &quot;result&quot;: {
              &quot;_id&quot;: &quot;62dd1b2e744e6bf8cdbcfabe&quot;
          },
          &quot;datetime&quot;: &quot;24/07/2022, 11:13:02&quot;,
          &quot;__v&quot;: 0
      },
      ...
  ]
  </code></pre>
  <p>I don't if the mistake is with the schema or I just need to use autopopulate or something</p>