Skip to content

mongoose Error: failed to connect to #1949

mackjoner opened this Issue Mar 7, 2014 · 2 comments

2 participants


I was config options

"mongodb": {
"url": "mongodb://localhost:27017/demo",
"options": {
"db": {
"native_parser": false
"server": {
"keepAlive": 1,
"poolSize": 10

node.js code

mongoose.connect(config.mongodb.url, config.mongodb.options);

my mongodb is replica set, I startup nodejs app, it's ok that write data in mongodb by mongoose , Then i shutdown mogodb's SECONDARY node 2, it's not ok that write data. error msg

Error: failed to connect to .....

I search the error in google, There is an article pointed out that this is a bug


List out all of the servers in your replica set in the url:


In the above example, mongoose thinks you're connecting to a standalone.

@vkarpov15 vkarpov15 closed this Apr 29, 2015

It's work good..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.