Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
c = Mongo::Connection.paired([['localhost', 27017], ['localhost', 27018]])
=> #<Mongo::Connection:0x1016c2418 @size=1, @checked_out=[], @connection_mutex=#<Mutex:0x1016c2300>, @logger=nil, @id_lock=#<Mutex:0x1016c22d8>, @options={}, @sockets=[], @nodes=[["localhost", 27017], ["localhost", 27018]], @timeout=5.0, @port=nil, @queue=#<ConditionVariable:0x1016c2238>, @auths=[], @slave_ok=nil, @host=nil, @safe_mutex=#<Mutex:0x1016c2260>>
c.database_info
Mongo::ConnectionFailure: Failed to connect socket: getaddrinfo: nodename nor servname provided, or not known
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/connection.rb:548:in `checkout_new_socket'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/connection.rb:582:in `checkout'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/connection.rb:578:in `synchronize'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/connection.rb:578:in `checkout'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/connection.rb:571:in `loop'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/connection.rb:571:in `checkout'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/connection.rb:389:in `receive_message'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/cursor.rb:339:in `send_initial_query'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/cursor.rb:316:in `refill_via_get_more'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/cursor.rb:311:in `num_remaining'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/cursor.rb:63:in `next_document'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/db.rb:453:in `command'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/connection.rb:217:in `database_info'
from (irb):11
c = Mongo::Connection.new("localhost", 27017, :slave_ok => true)
=> #<Mongo::Connection:0x1016de7d0 @size=1, @checked_out=[], @connection_mutex=#<Mutex:0x1016de640>, @logger=nil, @id_lock=#<Mutex:0x1016de6e0>, @options={:slave_ok=>true}, @sockets=[], @nodes=[["localhost", 27017]], @timeout=5.0, @port=nil, @queue=#<ConditionVariable:0x1016de5f0>, @auths=[], @slave_ok=true, @host=nil, @safe_mutex=#<Mutex:0x1016de618>>
c.database_info
Mongo::ConnectionFailure: Failed to connect socket: getaddrinfo: nodename nor servname provided, or not known
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/connection.rb:548:in `checkout_new_socket'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/connection.rb:582:in `checkout'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/connection.rb:578:in `synchronize'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/connection.rb:578:in `checkout'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/connection.rb:571:in `loop'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/connection.rb:571:in `checkout'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/connection.rb:389:in `receive_message'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/cursor.rb:339:in `send_initial_query'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/cursor.rb:316:in `refill_via_get_more'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/cursor.rb:311:in `num_remaining'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/cursor.rb:63:in `next_document'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/db.rb:453:in `command'
from /usr/local/ruby-1.8.6-p383/lib/ruby/gems/1.8/gems/mongo-1.0/lib/../lib/mongo/connection.rb:217:in `database_info'
from (irb):9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment