title: { MongoError: bad auth Authentication failed
body: <p>I am very new to node js and mongo db</p>
  <p>when i use npm start on my code,
  it gives this error</p>
  <pre><code>server running in production mode on port 5000
  { MongoError: bad auth Authentication failed.
      at MessageStream.messageHandler (/home/suyash/Documents/app/node_modules/mongodb/lib/cmap/connection.js:268:20)
      at MessageStream.emit (events.js:198:13)
      at processIncomingData (/home/suyash/Documents/app/node_modules/mongodb/lib/cmap/message_stream.js:144:12)
      at MessageStream._write (/home/suyash/Documents/app/node_modules/mongodb/lib/cmap/message_stream.js:42:5)
      at doWrite (_stream_writable.js:415:12)
      at writeOrBuffer (_stream_writable.js:399:5)
      at MessageStream.Writable.write (_stream_writable.js:299:11)
      at TLSSocket.ondata (_stream_readable.js:710:20)
      at TLSSocket.emit (events.js:198:13)
      at addChunk (_stream_readable.js:288:12)
      at readableAddChunk (_stream_readable.js:269:11)
      at TLSSocket.Readable.push (_stream_readable.js:224:10)
      at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:94:17) ok: 0, code: 8000, codeName: 'AtlasError', name: 'MongoError' }
  npm ERR! code ELIFECYCLE
  npm ERR! errno 1
  npm ERR! app@1.0.0 start: `cross-env NODE_ENV=production node app`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the app@1.0.0 start script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /home/suyash/.npm/_logs/2020-09-14T23_12_00_524Z-debug.log
  </code></pre>
  <p>i was trying to make a app and trying to connect with mongodb database</p>
  <p>in db.js file this was my code</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const mongoose = require('mongoose')
  
  const connectDB = async () =&gt; {
      try {
          const conn = await mongoose.connect(process.env.MONGO_URI, {
              useNewUrlParser:true,
              useUnifiedTopology: true,
              useFindAndModify: false,
          })
  
          console.log(`MONGODB connected: ${conn.connection.host}`);
  
          
      } catch (error) {
          console.error(error)
          process.exit(1)
      }
  }
  module.exports = connectDB</code></pre>
  </div>
  </div>
  </p>
  <p>i don't know what to do</p>