Findwise/Hydra

Support MongoDB replica sets

Closed this issue · 2 comments

The current MongoDB database implementation specifies a single instance. When using the Java MongoDB driver, in order to connect to a replica set or sharded cluster, the Mongo connection must be instantiated with a list of hosts.

The current MongoDB database implementation does not support replica sets.

note: Practically, anyway. It should be possible to connect to the primary replica, but since that can change at any time it is hardly a useful way to connect.

I've experimented a bit with this, and by using MongoClientURI and specifying the database url as mongodb://host:port,host2,port2 it's easy to support both standalone Mongo instances and replica sets.

Fixed by #258