node.js - MongoDB Driver for NodeJS, specifying multiple servers -


People, I'm trying to specify an array of MongoDB cluster hosts via my config.

config: {"host": {"ip1", "ip2", "ip3"], "port": 27017, "database": "auth",

The code works:

  this.server = new mongodb.Server (host [0], port, {auto_reconnect: true}); This.db_connector = new mongodb.Db (this.dbname, this.server);  

However, as you connect im to only ip1 If I have EC 2 examples in different areas, then reset the ID correctly. What I've read reveals what node is to write, and reads based on replication settings.

What is the proper way of specifying a Mongo cluster which is a multi-region I want to keep all areas bound to one area. Assume that the Mojo driver connects to the 'closest' DB host.

Thank you!


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -