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,
- 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'
: