0
votes

I've build a nest.js server and now I'm trying to connect mongoDB Atlas. In the app.module imports i've tried to connect with

mongodb+srv://<user>:<pass>@cluster0.iijhz.mongodb.net/<dbName>?retryWrites=true&w=majority

url string, but failed, now i've tried these options too:

imports: [
MongooseModule.forRoot(
  'mongodb+srv://cluster0.iijhz.mongodb.net',
  {
    user: '<user>',
    pass: '<pass>',
    dbName: '<dbName>',
    w: 'majority',
    retryWrites: true
  }
),

but still got

MongoError: Authentication failed.

my ip, and 0.0.0.0/0 is also added to whitelist.

1
Thanks, i've read the docs, and some articles about nest's MongooseModule, then read the docs for MongoDB Atlas, changed my password several times, and just after that all, checked the name of the db, which was wrong.Péter Ciprián Oláh

1 Answers

0
votes

Ok, surely my bad, the dbName wasn't correct the whole time.