Connect to mongodb instance from my ap

62 views
Skip to first unread message

Gabriel Majivu

unread,
Jan 19, 2014, 2:37:30 PM1/19/14
to mongoo...@googlegroups.com
I have run into a problem. I had a problem with my computer and accidentally forced a shut down of my computer. Now this has brought problems with my mongodb instance. I have followed steps here http://stackoverflow.com/a/16877505/645458 and resolved the shell connection. But apparently, I still cannot connect when I run my app. I get an error message: Connection error Error: failed to connect to [undefined:27017]

I can connect from the shell though. I haven't changed any code, so I am not sure what could be causing this problem.

Kindly assist.

Jason Crawford

unread,
Jan 19, 2014, 2:48:40 PM1/19/14
to mongoo...@googlegroups.com
Since it says “failed to connect to [undefined:27017]”, it looks as if your hostname variable is undefined. I would suggest making sure you are passing in the correct (defined) hostname to mongoose.connect().

-Jason



--
Documentation - http://mongoosejs.com/
Plugins - http://plugins.mongoosejs.com/
Bug Reports - http://github.com/learnboost/mongoose
Production Examples - http://mongoosejs.tumblr.com/
StackOverflow - http://stackoverflow.com/questions/tagged/mongoose
Google Groups - https://groups.google.com/forum/?fromgroups#!forum/mongoose-orm
Twitter - https://twitter.com/mongoosejs
IRC - #mongoosejs
---
You received this message because you are subscribed to the Google Groups "Mongoose Node.JS ODM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongoose-orm...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Gabriel Majivu

unread,
Jan 19, 2014, 3:31:12 PM1/19/14
to mongoo...@googlegroups.com
Yeah you got a point. I tried directly with the mongodb URI string and it worked. I have implemented my code with the module nconf to manage environment vars. It seems it is breaking and returns the undefined instead of the required string. So I have to find the bug.

Thanks for your help, Jason.
Reply all
Reply to author
Forward
0 new messages