Server Discovery And Monitoring engine is deprecated

后端 未结 23 1249
执笔经年
执笔经年 2020-12-01 00:54

I am using Mongoose with my Node.js app and this is my configuration:

mongoose.connect(process.env.MONGO_URI, {
   useNewUrlParser: true,
   useUnifiedTopol         


        
23条回答
  •  我在风中等你
    2020-12-01 01:02

    It is important to run your mongod command and keep the server running. If not, you will still be seeing this error.

    I attach you my code:

    const mongodb = require('mongodb')
    const MongoClient = mongodb.MongoClient
    
    const connectionURL = 'mongodb://127.0.0.1:27017'
    const databaseName = 'task-manager'
    
    MongoClient.connect(connectionURL, {useNewUrlParser: true, useUnifiedTopology: true}, (error, client) => {
        if(error) {
            return console.log('Error connecting to the server.')
        }
    
        console.log('Succesfully connected.')
    })

提交回复
热议问题