The 'useMongoClient' error is no longer necessary in mongoose 5.x, please remove it

1

I tried connecting to the bank using these settings;

'use strict'

var mongoose = require('mongoose');

mongoose.Promise = global.Promise;
mongoose.connect('mongodb://127.0.0.1:27017/ep', { useMongoClient: true })
        .then(() => {
                console.log('conexão realizada com sucesso')
        })
        .catch(err => console.log(err));

Attempting to run the application for testing generated this error;

 npm start

> [email protected] start C:\layout resposive\API\ep
> nodemon index.js

[nodemon] 1.17.4
[nodemon] to restart at any time, enter 'rs'
[nodemon] watching: *.*
[nodemon] starting 'node index.js'
WARNING: The 'useMongoClient' option is no longer necessary in mongoose 5.x, please remove it.
    at handleUseMongoClient (C:\layout resposive\API\ep\node_modules\mongoose\lib\connection.js:506:17)
    at NativeConnection.Connection.openUri (C:\layout resposive\API\ep\node_modules\mongoose\lib\connection.js:407:7)
    at Mongoose.connect (C:\layout resposive\API\ep\node_modules\mongoose\lib\index.js:208:15)
    at Object.<anonymous> (C:\layout resposive\API\ep\index.js:6:10)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
    at startup (internal/bootstrap/node.js:201:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)
conexão realizada com sucesso

Does anyone have a suggestion?

    
asked by anonymous 16.05.2018 / 13:56

1 answer

3

This was one of the changes from version 4 to 5, in the manual of migration talk about it . Basically: since version 5 this option has been removed, the value is always true , so it is now an error to pass this configuration option.

    
16.05.2018 / 14:04