-
Notifications
You must be signed in to change notification settings - Fork 0
Connecting to database
fl00r edited this page Apr 4, 2013
·
1 revision
client = Monga::Client.new
# not default host/port
client = Monga::Client.new(host: "123.123.123.123", port: 28017)
# Connection pooling
client = Monga::Client.new(pool_size: 10)servers = [
{host: "123.123.123.123", port: 27017},
{host: "124.124.124.124", port: 27017},
{host: "125.125.125.125", port: 27017}
]
client = Monga::ReplicaSetClient.new(servers: servers, pool_size: 5)Read Preferrences
-
:primary(default) :secondary:primary_preferred:secondary_preferred-
:nearest(unimplemented)
client = Monga::ReplicaSetClient.new(servers: servers, pool_size: 10, read_pref: :secondary)