Ho seguente configurazione:Collegamento a MongoDb utilizzando mangusta - Errore: getaddrinfo ENOTFOUND
"mongoose": {
"url": "mongodb://127.0.0.1:27017/chat",
"options": {
"server": {
"socketOptions": {
"keepAlive": 1
}
}
}
}
E connettono al DB
mongoose.connect(config.get('mogoose:url'), config.get('mongoose:options'))
Ma sto ottenendo tale errore:
node_modules/mongoose/node_modules/mongodb/lib/server.js:236
process.nextTick(function() { throw err; })
^
Error: getaddrinfo ENOTFOUND undefined undefined:27017
at errnoException (dns.js:27:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:78:26)
Ho già controllato le risposte per simular question.
Sono abbastanza nuovo a Mongo, ma seguente codice funziona bene con driver nativo:
var MongoClient = require('mongodb').MongoClient
, format = require('util').format;
MongoClient.connect('mongodb://127.0.0.1:27017/chat', function(err, db) {
if (err) throw err;
//blabla
}
Così risposte per questa domanda non sono attuale nel mio caso.
che è '' config''? –
@AlexeyB. si, è – mondayguy