title: NestJs - How to use the same schema & collection for different connections?
body: <p>I need to establish two different connections to the same mongodb, but with different connection options (<strong>poolSize</strong>, <strong>readPreference</strong>, etc.) of course with different connectionName. The <strong>MongooseModules</strong> are imported in the <strong>AppModule</strong></p>
  <pre><code>@Module({
    imports: [CustomMongooseDynamicModule, CustomSlavegooseDynamicModule, ...],
    ...
  })
  export class AppModule {}
  </code></pre>
  <p>Then in some other module I would like to use the same schema/model for each of these connections - note that collection names are the same, connection names are different</p>
  <pre><code>@Module({
    imports: [
      MongooseModule.forFeature([{ name: &quot;ABC&quot;, schema: AbcSchema }], &quot;main&quot;),
      MongooseModule.forFeature([{ name: &quot;ABC&quot;, schema: AbcSchema }], &quot;slave&quot;),
    ],
    controllers: [SomeController],
    providers: [SomeService]
  })
  export class SomeModule {}
  </code></pre>
  <p><strong>The question is</strong> - how can I inject the model into the <strong>SomeService</strong> for <strong>'main'</strong> &amp; <strong>'slave'</strong> connection separately?</p>
  <pre><code>@InjectModel('ABC') private readonly abcModel: Model&lt;AbcDocument&gt;,
  @InjectModel('ABC') private readonly abcSlaveModel: Model&lt;AbcDocument&gt;, ???
  </code></pre>