Tentei conectar ao banco usando essas configurações;
'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));
Ao tentar executar a aplicação para teste gerou esse erro;
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
Alguém tem uma sugestão?