Skip to content

Instantly share code, notes, and snippets.

@ivaravko
Forked from banker/repl_set_connection.rb
Created July 31, 2011 14:15
Show Gist options
  • Save ivaravko/1116823 to your computer and use it in GitHub Desktop.
Save ivaravko/1116823 to your computer and use it in GitHub Desktop.
ReplSetConnection.new(['db1.app.com'], ['db2.app.com'],
:rs_name => "myapp")
ReplSetConnection.new(['db1.app.com'], ['db2.app.com'],
:read_secondary => true)
@con = ReplSetConnection.new(['db1.app.com', 27017], ['db2.app.com', 27017])
@con = Connection.new("localhost", 27017, :safe => {:w = 3})
@db = @con['myapp']
@collection = @db['users']
@collection.insert({:username => "banker"})
@collection.insert({:username => "banker"}, :safe => {:w = 3})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment