title: How to reference Mongoose model in different NestJS module
body: <p>I'm new to NestJS.  I'm sure this is a simple question, but I just can't find the answer.</p>
  
  <p>In the <a href="https://docs.nestjs.com/techniques/mongodb#model-injection" rel="noreferrer">nest docs</a> it recommends having one module per model.  This involves creating the model using <code>MongooseModule.forFeature</code>:</p>
  
  <pre class="lang-js prettyprint-override"><code>imports: [MongooseModule.forFeature([{ name: 'Cat', schema: CatSchema }])]
  </code></pre>
  
  <p>The docs say:</p>
  
  <blockquote>
    <p>If you also want to use the models in another module, add MongooseModule to the <code>exports</code> section of <code>CatsModule</code> and import <code>CatsModule</code> in the other module</p>
  </blockquote>
  
  <p>My question is how to reference the model in the new module.</p>
  
  <p>I can see:</p>
  
  <ol>
  <li><a href="https://stackoverflow.com/questions/51819504/inject-nestjs-service-from-another-module">How this would be done</a> if the model had been created using <code>mongoose.model('Name', MySchema)</code></li>
  <li><a href="https://github.com/nestjs/mongoose/issues/1" rel="noreferrer">What exports are needed</a> </li>
  <li><a href="https://stackoverflow.com/questions/57431221/schema-hasnt-been-registered-for-model-resourceschema-nest-js">A question</a> that implies this would be done using <code>import { Model } from 'mongoose'; @InjectModel('name') myModel: Model&lt;MyInterface&gt;)</code>, but that feel like it repeats the model creation that is done by <code>MongooseModule.forFeature</code>, because it's combining mongoose Model with the schema again</li>
  </ol>
  
  <p>Any help appreciated!</p>