Warning on Connecting to MongoDB with a Node server

后端 未结 5 1446
有刺的猬
有刺的猬 2021-02-01 03:16

Connecting with MongoDB native driver

I wrote following code to connect mongodb through native driver which has been install with npm install mongodb --save

5条回答
  •  悲哀的现实
    2021-02-01 03:28

    Replace yourdbname with your variable or just link of your mongodb..

     mongoose.connect(yourdbname, {useUnifiedTopology: true, useNewUrlParser: true, useCreateIndex: true })
      .then(console.log("mongodb connected successfully...."))
      .catch(err =>console.log(err));
    

提交回复
热议问题