1

I am interested to connect to a mongodb database hosted on mms using mongojs module. If one database instance fails, mms will make one of the other database instances to become primary.But is IP address changes. How the server application where blocking timeouts are not allowed should be able to automatically connect to rest of available database instances. I am looking for something like

  var db = require('mongojs').connect(url1,url2,url3);  
hello world
  • 660
  • 2
  • 6
  • 25
  • 2
    If you have replica set (http://docs.mongodb.org/manual/reference/replica-configuration/) configured mongoose will accept a URL with multiple hosts like this: `mongodb://user:password@hostA:portA,hostB:portB/database?replicaSet=set-12345`. Is that what you're looking for? – Andrew Lavers May 05 '15 at 23:00
  • yeah Andrews, exactly, but iam using mongojs module. Does it work as I have very little time to switch over from mongojs to mongoose? – hello world May 05 '15 at 23:23

0 Answers0