S
S
Sveratum2013-11-14 08:26:47
MongoDB
Sveratum, 2013-11-14 08:26:47

How to "connect" NodeJs to ReplicaSet Mongodb

Good afternoon! The question is: There is a mongo replica with three servers (three separate machines), how nodejs will connect to the replica, there is a description on the site, but there is no good example, until I could figure it out on my own. The standard Node.JS MongoDB Driver is used. The latest stable software versions are used. Operating system Centos 6.4 x64.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rpsl, 2013-11-14
@srsd

http://mongodb.github.io/node-mongodb-native/markdown-docs/replicaset.html ?

T
Timur Batyrshin, 2013-11-14
@erthad

I won’t speak for NodeJS, but in general, according to the MongoDB ideology, it’s enough to connect to one of the servers in the replica, and it will give the client information about the replicas. It is better, of course, to specify all the replicas so that the application can connect to the database if any of them fail. In other languages, it was possible to specify a list of replicas simply separated by commas.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question