Skip to content

Instantly share code, notes, and snippets.

@rpechayr
Last active October 12, 2015 14:22
Show Gist options
  • Save rpechayr/782df4b8b270bde21d7c to your computer and use it in GitHub Desktop.
Save rpechayr/782df4b8b270bde21d7c to your computer and use it in GitHub Desktop.
Different cases with down hosts
require 'mongo'
#Here I don't have any mongod listening on port 29017
client = Mongo::Client.new([ "127.0.0.1:29017", '127.0.0.1:27017' ], :database => 'test')
result = client[:artists].insert_one({ name: 'FKA Twigs' })
require 'mongo'
client = Mongo::Client.new([ "8.8.8.8:27017", '127.0.0.1:27017' ], :database => 'test')
result = client[:artists].insert_one({ name: 'FKA Twigs' })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment