title: Unable to connect mongoDB using nestjs/mongoose
body: <p>I have a nest.js node server and I am trying to connect mongoDB data base in the app.module, when the connection string doesn't contains the DB name - the connection to default DB &quot;test&quot; success, but when I specify the DB name- always getting &quot;Authentication failed&quot; error.</p>
  <p>app.module.ts:</p>
  <p>This works:</p>
  <pre><code>  imports: [
      MongooseModule.forRoot('mongodb://admin:admin@localhost:30000'),
    ]
  </code></pre>
  <p>But this specifying the DB name failed with Authentication error:</p>
  <pre><code>  imports: [
      MongooseModule.forRoot('mongodb://admin:admin@localhost:30000/test'),
    ]
  </code></pre>
  <p>or:</p>
  <pre><code>  imports: [
      MongooseModule.forRoot('mongodb://admin:admin@localhost:30000/data'),
    ]
  </code></pre>
  <p>Using MongoClient directly (without nestjs) connecting successfully:</p>
  <pre><code>const client = new MongoClient('mongodb://admin:admin@localhost:30000');
  await client.connect();
  db = client.db('data');
  </code></pre>
  <p>Any idea what is my problem and what should I do in order to solve this problem?</p>
  <p>Thanks.</p>