UnhandledPromiseRejectionWarning: MongooseServerSelectionError

后端 未结 3 577
梦谈多话
梦谈多话 2020-11-28 16:23

I am following these tutorials as I wanted to start with MongoDB and the MERN stack:

  • https://medium.com/@beaucarnes/learn-the-mern-stack-by-building-an-exercis
3条回答
  •  囚心锁ツ
    2020-11-28 17:04

    Try this It seems like you are using MongoDB atlas

    mongoose
         .connect( uri, { useNewUrlParser: true, useCreateIndex: true, useUnifiedTopology: true })
         .then(() => console.log( 'Database Connected' ))
         .catch(err => console.log( err ));
    

    and go to your MongoDB Atlas -> NetworkAccess-> Edit-> and add Current IP address it works!!

提交回复
热议问题