Dans le serveur nodejs, mongodb ne se connecte pas. Le code d'erreur sur le terminal montre
[nodemon] restarting due to changes...
[nodemon] starting `node app.js`
Server started on port 5000
MongoParseError: URI does not have hostname, domain name and tld
at parseSrvConnectionString (/home/psayeed1990/programming/node/node_passport_login-master/node_modules/mongodb/lib/core/uri_parser.js:41:21)
at parseConnectionString (/home/psayeed1990/programming/node/node_passport_login-master/node_modules/mongodb/lib/core/uri_parser.js:516:12)
at connect (/home/psayeed1990/programming/node/node_passport_login-master/node_modules/mongodb/lib/operations/connect.js:266:3)
at ConnectOperation.execute (/home/psayeed1990/programming/node/node_passport_login-master/node_modules/mongodb/lib/operations/connect.js:191:5)
at executeOperation (/home/psayeed1990/programming/node/node_passport_login-master/node_modules/mongodb/lib/operations/execute_operation.js:83:26)
at MongoClient.connect (/home/psayeed1990/programming/node/node_passport_login-master/node_modules/mongodb/lib/mongo_client.js:216:10)
at /home/psayeed1990/programming/node/node_passport_login-master/node_modules/mongoose/lib/connection.js:632:12
at new Promise (<anonymous>)
at NativeConnection.Connection.openUri (/home/psayeed1990/programming/node/node_passport_login-master/node_modules/mongoose/lib/connection.js:629:19)
at Mongoose.connect (/home/psayeed1990/programming/node/node_passport_login-master/node_modules/mongoose/lib/index.js:328:15)
at Object.<anonymous> (/home/psayeed1990/programming/node/node_passport_login-master/app.js:18:4)
at Module._compile (internal/modules/cjs/loader.js:1128:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:983:32)
at Function.Module._load (internal/modules/cjs/loader.js:891:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
name: 'MongoParseError',
[Symbol(mongoErrorContextSymbol)]: {}
Voici le code pour se connecter
dbPassword = 'mongodb+srv://sayeed:'+ encodeURIComponent('123456') + 'mongodb://localhost:27017/node-passport-login';
module.exports = {
mongoURI: dbPassword
};
L'application nodejs complète est tirée de la page github de Traversy Media, Node Passport Login.