const uri = mongodb+srv://${process.env.DB_USER}:${process.env.DB_PASS}@cluster0.twqkk.mongodb.net/?retryWrites=true&w=majority
;
const client = new MongoClient(uri, { useNewUrlParser: true, useUnifiedTopology: true, serverApi: ServerApiVersion.v1 });
Asked
Active
Viewed 26 times
0

Abu Naem
- 1
-
The exception is clearly say what's wrong, you should check your auth configuration – dododo May 20 '22 at 13:51
-
See https://stackoverflow.com/questions/63754742/authentication-failure-while-trying-to-save-to-mongodb/63755470#63755470 – Wernfried Domscheit May 20 '22 at 22:00