0

My port is 5000 MongoServerError: bad auth : Authentication failed. at Connection.onMessage (E:\React\Projects\assignment11\express\node_modules\mongodb\lib\cmap\connection.js:203:30) at MessageStream. (E:\React\Projects\assignment11\express\node_modules\mongodb\lib\cmap\connection.js:63:60) at MessageStream.emit (node:events:390:28) at processIncomingData (E:\React\Projects\assignment11\express\node_modules\mongodb\lib\cmap\message_stream.js:108:16) at MessageStream._write (E:\React\Projects\assignment11\express\node_modules\mongodb\lib\cmap\message_stream.js:28:9) at writeOrBuffer (node:internal/streams/writable:389:12) at _write (node:internal/streams/writable:330:10) at MessageStream.Writable.write (node:internal/streams/writable:334:10) at TLSSocket.ondata (node:internal/streams/readable:754:22) at TLSSocket.emit (node:events:390:28) { ok: 0, code: 8000, codeName: 'AtlasError', [Symbol(errorLabels)]: Set(0) {}

I tried so many times by changing the username password and also delete and recreate this. But Still, the problem occurs. I don't understand exactly why is this happening. Can anyone help me to tell the exact reason behind this?

  • Will you please Elaborate? From the current info I can't get though what can go wrong. There are many aspect when it comes mongodb. firstly There is a need to run mongod in one terminal for local connection. Your connection must be according to the documentation. But if you want don't want to go through all this hassale mongodb is way too easy to use with a pakage named mongoose try using it. https://mongoosejs.com/ . – Hero SHIMA May 07 '22 at 12:03
  • @sarthakchauhan I followed all the instructions from MongoDB documents. But all are gone fail. Finally, I create a new user and collection and connected it. I spent a lot of time on three projects. Then new credential worked. Thank you for suggesting mongoose js. I will check it out. – Shaikh Najmul Islam May 16 '22 at 12:20
  • okh bro no biggie! you've figured it out. I'm happy about it. – Hero SHIMA May 17 '22 at 11:07

0 Answers0