Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

mongoose Error: failed to connect to #1949

Closed
mackjoner opened this Issue · 2 comments

2 participants

@mackjoner

hi,
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
https://gist.github.com/asalant/4092454
really?

@vkarpov15
Owner

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

mongodb://localhost:27017,localhost:27018,localhost:27019/demo

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

@vkarpov15 vkarpov15 closed this
@mackjoner

It's work good..
Thanks

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.