Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-891

Can't connect the driver to mongos if :connect option is omitted.

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.0.3
    • Affects Version/s: 2.0.2
    • Component/s: Auth
    • None
    • Environment:
      CentOS 6.4
      MongoDB 3.0.1 (authentication mechanism : SCRAM-SHA-1)
      Ruby 2.1.2

      Can't connect the driver to mongos if :connect option is omitted.
      Auto-discovery mechanism may not work.
      The following code runs correctly, If ':connect => :sharded' is specified in Mongo::Client.new option,

      1. Ruby Code
        > db = Mongo::Client.new(
        ['test-server:20001'],
        :database => "admin",
        :user => "admin_user",
        :password => "admin_pass")
        > db["test_col"].find.count

      Mongo::ServerSelector::NoServerAvailable: No server is available matching preference: #<Mongo::ServerSelector::Primary:0x00000002a12258 @tag_sets=[], @options={:database=>"test", :user=>"admin_user", :password=>"admin_pass"}, @server_selection_timeout=30>
      from /home/dep/.rvm/gems/ruby-2.1.2/gems/mongo-2.0.2/lib/mongo/server_selector/selectable.rb:99:in `select_server'
      from /home/dep/.rvm/gems/ruby-2.1.2/gems/mongo-2.0.2/lib/mongo/database.rb:130:in `command'
      from /home/dep/.rvm/gems/ruby-2.1.2/gems/mongo-2.0.2/lib/mongo/collection/view/readable.rb:124:in `count'
      :

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            incredible_hana Onari Tanaka
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: