rmongodb
rmongodb copied to clipboard
Can't connect to multiple servers
Creating a mongoDB connection can only be done to one server with
mongo <- mongo.create(host = "myserver1:27017")
and not multiple servers like
mongo <- mongo.create(host = "myserver1:27017, myserver2:27017, myserver3:27017")
# or alternatively:
mongo <- mongo.create(host = c("myserver1:27017", "myserver2:27017", "myserver3:27017"))
however for mongoDB it is necessary, to connect to the master node, which is switching from time to time. Therefore I would like to have two features implemented:
1 It should be possible to set multiple servers and rmongodb is looking autonomously which one is the master. 2 It should be possible to set the setting
slave = "ok"
for those use-cases in which rmongodb only reads. This feature would allow to read from a slave node (writing to a slave is not possible for mongoDB), and would reduce the load on the master node.
Last code chunk should work. Please, check this SO thread. If not, let me know.