Versions I am using
Ubuntu 14.04
MongoDB 3.0.1 with --storageEngine wiredtiger enabled
Mongoose 4.0.1
Node JS 0.12.2
My Dev environment is Mac and everything works good. I pointed my dev environment to live mongoDB and it works.
But when I try the same in my staging with the above versions I get the below error after a while.
/home/ShopWaveServices/api/Up/CoreDB/node_modules/mongoose/node_modules/mongodb/lib/server.js:228
process.nextTick(function() { throw err; })
^
Error
at Object.<anonymous> (/home/ShopWaveServices/api/Up/CoreDB/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/error.js:42:24)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/home/ShopWaveServices/api/Up/CoreDB/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/index.js:2:17)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
Please help.
I tried setting up auth in mongod, Ports are open for all the required IP addresses.
Please help me fix this.
Many thanks,
Karthik
How are you connecting with mongoose? If the mongod server uses auth, are you specifying auth credentials when you connect?
Thank you for your fast response. It doesn't work even without --auth in mongod.
I get the same error. :)
Thank you..
How are you connecting with mongoose? Can you connect using the shell?
Yes I can connect it with the shell. Also I can connect mongoose without auth credentials in my Dev MacOS machine.
Same code doesnt work in Ubuntu. I also uninstalled and reinstalled mongoose just in the Ubuntu Machine.
Currently I connect without --auth like in my local and it works..
var path = 'mongodb://' + _config.mongoDB.dbHost + ':27017/' + _config.mongoDB.dbName;
try
{
connect = mongoose.connect(path);
//mongoose.set('debug', true);
}
catch(e)
{
console.log(e);
}
I hope I understood your question properly.
Many thanks,
Karthik
Hmm can you connect using the mongodb shell on the ubuntu machine? Also, can you make sure the path that you're passing to mongoose.connect() is correct?
No response for a couple weeks and can't repro. Re-open if still its an issue.
This is still reproducible in 4.0.0 module.
Please provide steps to repro @luqman523
The matter in discussion can easily be debugged by inspecting the url/uri, and decreasing your timeout. If you find yourself with a timeout error at 1 - 10 ms, it serves as a good sanity check. Otherwise, what you are experiencing is likely due to an improper URL or import that you may also try to substitute as a connection string. In my experience this is not an issue.
I am still getting the same problem
process.nextTick(function() { throw err; })
^
Error: connect ECONNREFUSED 165.225.138.63:27017
at Object.exports._errnoException (util.js:874:11)
at exports._exceptionWithHostPort (util.js:897:20)
at TCPConnectWrap.afterConnect as oncomplete
Using modulus.io mongodb
Can you connect using the mongodb shell?
Make sure you turn on mongodb by running 'mongod' inside your teminal or command line.
Same issue :(
process.nextTick(function() { throw err; })
^
Error: getaddrinfo ENOTFOUND localhost
at errnoException (dns.js:44:10)
at GetAddrInfoReqWrap.onlookup as oncomplete
Mongo server status:
waiting for connections on port 27017
Try 127.0.0.1 instead of localhost
@vkarpov15 Is there a reason why 127.0.0.1 works but not localhost?
Not sure, DNS is up to your OS, mongoose and mongodb don't do anything with that.
Most helpful comment
Try 127.0.0.1 instead of localhost