0
const uri=`mongodb+srv://${process.env.DB_USER}:${process.env.DB_PASS}@cluster0.crceb.mongodb.net/myFirstDatabase?retryWrites=true&w=majority`;

When I run the code I am getting the following error

"MongoError: bad auth Authentication failed."

Any ideas that's mean?

Wernfried Domscheit
  • 46,769
  • 7
  • 65
  • 91

1 Answers1

0

Check the env file correctly. And add project name too. If not, then change the password so that if it includes a number, write just a letter. You can try another world inside of DB_USER

check your env data in console.log and consider it with your env file