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

JuanR
- 7,405
- 1
- 19
- 30
-
Please don't paste screenshots, use formatted text. See https://meta.stackoverflow.com/q/285551 – Wernfried Domscheit May 19 '22 at 18:51
-
Typically the error is that you did not specify the authentication source, see https://stackoverflow.com/questions/63754742/authentication-failure-while-trying-to-save-to-mongodb/63755470#63755470 – Wernfried Domscheit May 19 '22 at 18:53