SergejJurecko/erlmongo

multiple mongo servers (not known at compile time)

vladp opened this issue · 1 comments

we have mutliple mongo servers whose IP addresses and host names we do not know at 'compile' time. Wanted to know if it is possible to use this driver to connect to them at run time.

So far it appears that mongodb is expected to be a process, and has to be restarted If I have to switch to a different mongo host. That would mean I cannot simultaneously connect and query multiple mongo DBs running on different hosts.

Would like to ask if I am mis interpreting the functionality available in this driver, and if yes - -how do I manage connections to multiple mongodb hosts.

thank you

The api calls are mongodb:singleServer/masterSlave/replicaPairs to configure connections and mongodb:connect/1 to connect. So it all has to happen at runtime anyway.

Every connection needs an atom name and a process is registered under that name to handle connection to the DB. You can have as many connections as you wish.